override fun getItemViewType(position: Int): Int {
    return position
}

어뎁터에 이거 추가해주기

 

 

추가 해당 포지션을 바로 받았을때 포지션변경시 아이템 무브에서 스와이프시 한칸씩 칸이 움직일때마다 스와이프가 끊기는 버그가 생김. 해당 코드를 수정함

참조) https://reakwon.tistory.com/93

 

[안드로이드/android] RecyclerView 사용법(Recycler Adpater, View Holder, 이벤트 전달)

RecyclerView RecyclerView는 ListView와 비슷하나 조금 더 진보한 View입니다. RecyclerView는 ListView에 비해서 많은 최적화를 거치게 됐고, 수 많은 데이터를 처리하는데 효과적입니다. 그렇다면 RecyclerView가

reakwon.tistory.com

 private val TYPE_HEADER = 0
 private val TYPE_ITEM = 1
override fun getItemViewType(position: Int): Int {
    if(position==0) return TYPE_HEADER
    return TYPE_ITEM
}

 

'프로그래밍 > kotlin' 카테고리의 다른 글

공용 로딩바 만들기  (0) 2023.03.20
[kotlin]내부저장소 사용하기  (0) 2023.03.17
[kotlin]Handler deprecated  (0) 2022.11.10
[kotlin]locationRequest Deprecated  (0) 2022.11.10
[kotlin] vibrator Deprecated  (0) 2022.11.10
val handler = Handler()
val handler = Handler(Looper.getMainLooper())

위의 내용에 Looper.getMainLooper() 로 변경해주시면 됩니다

 

. -끝-

'프로그래밍 > kotlin' 카테고리의 다른 글

[kotlin]내부저장소 사용하기  (0) 2023.03.17
리사이클러뷰 뷰가 꼬일때  (0) 2023.01.05
[kotlin]locationRequest Deprecated  (0) 2022.11.10
[kotlin] vibrator Deprecated  (0) 2022.11.10
[코틀린] 핸들러  (0) 2022.07.20
  val locationRequest2 = LocationRequest.Builder(Priority.PRIORITY_HIGH_ACCURACY,2000) //2초마다 인터발
            .setWaitForAccurateLocation(false)
            .setMinUpdateIntervalMillis(500)
            .setMaxUpdateDelayMillis(1000)
            .build();

/*
        val locationRequest = LocationRequest.create()?.apply {
            priority = LocationRequest.PRIORITY_HIGH_ACCURACY
            interval = 2 * 1000
            fastestInterval = 1 * 1000

        }
*/

주석과같이 쓰시던 내용을 변경해주시면 되겠습니다 -끗0

'프로그래밍 > kotlin' 카테고리의 다른 글

[kotlin]내부저장소 사용하기  (0) 2023.03.17
리사이클러뷰 뷰가 꼬일때  (0) 2023.01.05
[kotlin]Handler deprecated  (0) 2022.11.10
[kotlin] vibrator Deprecated  (0) 2022.11.10
[코틀린] 핸들러  (0) 2022.07.20
/* val vibrator = getSystemService(Context.VIBRATOR_SERVICE) as Vibrator
                    vibrator.vibrate(500)*/

                    val vibrator = if( Build.VERSION.SDK_INT >=Build.VERSION_CODES.S){
                        val vibeManager : VibratorManager = getSystemService(Context.VIBRATOR_MANAGER_SERVICE) as VibratorManager

                        vibeManager.defaultVibrator
                    }else{
                        @Suppress("DEPRECATION")
                       getSystemService(Context.VIBRATOR_SERVICE) as Vibrator
                    }

                    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O){ // api level 26 이상
                        vibrator.vibrate(VibrationEffect.createOneShot(500, VibrationEffect.DEFAULT_AMPLITUDE))
                    }else {
                        vibrator.vibrate(500)
                    }

기존에 주석처럼 사용하던것을 아래와 같이 버전 체크를 통해 변경해주시면 됩니다. -끗

'프로그래밍 > kotlin' 카테고리의 다른 글

[kotlin]내부저장소 사용하기  (0) 2023.03.17
리사이클러뷰 뷰가 꼬일때  (0) 2023.01.05
[kotlin]Handler deprecated  (0) 2022.11.10
[kotlin]locationRequest Deprecated  (0) 2022.11.10
[코틀린] 핸들러  (0) 2022.07.20

platform-tools 설치확인

D:\slsolution\platform-tools

 

 - 안드로이드 스튜디오가 설치된 PC와 USB 연결
 - 스마트폰의 화면을 끔
 - 어플에서 특정 기능을 테스트하는 경우, 어플을 킨 후 테스트할 항목을 진행 시킨 후에 화면을 끔

 

adb devices 디바이스 연결확인

 

  1. 다음 명령어를 실행하여 강제로 시스템을 유휴 모드로 지정합니다.
     
        $ adb shell dumpsys deviceidle force-idle
        
  2. 준비가 되면 다음 명령어를 실행하여 유휴 모드를 종료합니다.
     
        $ adb shell dumpsys deviceidle unforce
        
  3. 다음 명령어를 실행하여 기기를 다시 활성화합니다.
     
        $ adb shell dumpsys battery reset
          
    private class TextHandler(service: SendLocationService) : Handler() {
         val serviceWeak: WeakReference<SendLocationService>

        override fun handleMessage(msg: Message) {
            super.handleMessage(msg)
            val service = serviceWeak.get()
            if (msg.what ==1) {
                service?.setMyTextHandler(msg.data)
            }
        }
        init {
            serviceWeak = WeakReference(service)
        }
    }
    fun setMyTextHandler(data: Bundle){
        val abc = data.getString("abc");
    }
		var handler = TextHandler(this);

        val msg = Message();
        msg.what =1;

        msg.data = Bundle();
        msg.data.putString("abc","dddd");

        handler.sendMessage(msg);

'프로그래밍 > kotlin' 카테고리의 다른 글

[kotlin]내부저장소 사용하기  (0) 2023.03.17
리사이클러뷰 뷰가 꼬일때  (0) 2023.01.05
[kotlin]Handler deprecated  (0) 2022.11.10
[kotlin]locationRequest Deprecated  (0) 2022.11.10
[kotlin] vibrator Deprecated  (0) 2022.11.10

Cannot run with sound null safety, because the following dependencies don't support null safety: - package:english_words

 

Run/Debug configurations 

Additional run args: --no-sound-null-safety 입력

 

or

pubspec.yaml 을

sdk 버전 변경 

기존 sdk 2.15.0 -> 2.7.0 으로 변경

sdk: ">=2.7.0 <3.0.0"

리스트 데이터 ~

		HashMap<String, String> data = new HashMap<String, String>();
		Calendar cal = Calendar.getInstance();
		SimpleDateFormat fomat = new SimpleDateFormat("yyyy-MM-dd", Locale.KOREA);
		cal.add(cal.DATE, -1);
		String yesterday = fomat.format(cal.getTime());
		JSONArray responseArray = null;
		JSONObject responseObject = null;
		JSONObject responseObject2 = null;
 
		StringBuilder sb = new StringBuilder();
        try{
            String url = "http://host/getCommonSelect?date=" + yesterday;
			URL obj = new URL(url);
			HttpURLConnection con = (HttpURLConnection) obj.openConnection();
			con.setRequestMethod("GET");
			BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream(), "UTF-8"));
			String line;
			while ((line = br.readLine()) != null) {
				sb.append(line);
				responseObject = new JSONObject(sb.toString());
			}
			responseArray = new JSONArray(responseObject.get("list").toString());
			if (responseArray.length() == 0) {
				throw new Exception();
			}
			for (int i = 0; i < responseArray.length(); i++) {
				responseObject2 = new JSONObject(responseArray.get(i).toString());
				HashMap<String, Object> params = new HashMap<String, Object>();
				params.put("data_name", responseObject2.get("data"));
                
                }
          }catch(Exception e){
          e.printStackTrace();
          }

 

'프로그래밍 > Java,eclipse' 카테고리의 다른 글

http multipartRequest 사진전송,파일전송 (저장용)  (0) 2021.07.15
이해하기 폴리곤 알고리즘  (0) 2019.05.23
eclipse SVN 설치중 오류  (0) 2019.05.02
배경 테마 바꾸기  (0) 2018.10.25
연산자의 종류  (0) 2018.10.25

+ Recent posts