java에서 코드로 구현해주는 방식으로 사용해야 버튼 클릭이 작동한다.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | public class MainFragment extends Fragment implements MapView.CurrentLocationEventListener, View.OnClickListener {     ...     @Override     public View onCreateView(LayoutInflater inflater, final ViewGroup container,                              Bundle savedInstanceState) {         ...         // Fragment에서는 onClick을 사용할 수 없기때문에,  별도로 리스너를 달아서 클릭이벤트를 지정한다.         ImageButton btn = v.findViewById(R.id.btn);         Button btn_in = v.findViewById(R.id.btn_in);         Button btn_out = v.findViewById(R.id.btn_out);         Button btn_exOut = v.findViewById(R.id.btn_exOut);         btn.setOnClickListener(this);         btn_in.setOnClickListener(this);         btn_exOut.setOnClickListener(this);         btn_out.setOnClickListener(this);         ...     }     // 버튼 클릭 이벤트 리스너     @Override     public void onClick(View view) {         switch (view.getId()){             //출근버튼             case R.id.btn_in:                  //출근 관련 로직                 Toast.makeText(getContext(),"출근 완료",Toast.LENGTH_SHORT).show();                 break;             //퇴근 버튼             case R.id.btn_out:                  //퇴근 관련 로직                 Toast.makeText(getContext(),"퇴근 완료",Toast.LENGTH_SHORT).show();                 break;             //예외 퇴근 버튼             case R.id.btn_exOut:                  // 예외 퇴근 관련 로직                 Toast.makeText(getContext(),"예외 퇴근 완료",Toast.LENGTH_SHORT).show();                 break;             // 우측 상단 현위치+범위표시 이미지버튼             case R.id.btn:                  mapView.setShowCurrentLocationMarker(true);                 mapView.setCurrentLocationRadius(100);                 mapView.setZoomLevel(1,true);                 break;         }     } } | cs | 
'Debug' 카테고리의 다른 글
| FCM JSON Encoding (0) | 2020.08.06 | 
|---|---|
| WebApp Debugging, No device Found (0) | 2020.07.11 | 
| (HTTPLog)-Static: isSBSettingEnabled false (0) | 2020.07.11 | 
| ERROR: this project use AndroidX dependencies, but the 'android.useAndroidX" property is not enabled (0) | 2020.07.11 | 
| Realm access from incorrect thread. Realm objects can only be accessed on the thread they were created. (0) | 2020.07.11 | 
 
                    
                   
                    
                   
                    
                  