본문 바로가기

IT/Android101

Kotlin] 안드로이드 Fragment findViewById Null [안드로이드] Fragment에서 findViewById 에러 해결 방법 Fragment에서 findViewById error Fragment에서 바인딩을 위해 findViewById() 함수를 사용한다면 다음과 같은 오류가 발생합니다. java.lang.NullPointerException: Attempt to invoke virtual method 'android.v.. swalloow.tistory.com override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View? { val view = inflater.inflate(R.layout.fragment, cont.. 2021. 5. 22.
Kotlin] 안드로이드 국가별 시간, 날짜 표시 // getBestDateTimePattern Format DateTime in Android - AndroidWave In this tutorials, We explain How to Format DateTime in Android using SimpleDateFormat. Example Include - Format Date to Text and Parse Text to Date androidwave.com Codota Codota search - find any Java class or method www.codota.com val skeleton: String = DateFormat.getBestDateTimePattern(Locale.getDefault(), "MMMM d") val formatter = SimpleDateFormat(ske.. 2021. 5. 20.
Kotlin] 안드로이드 채팅방 날짜 표시 How do I display the calendar date on the top of chat messages? I am working on a chat application but I am struggling to figure out how to display the calendar date on the top of chat messages; for example, something like this: Another image with timestamps: ... stackoverflow.com 각 채팅 메세지에 대한 Adapter에 해당 코드를 넣어준다. override fun onBindViewHolder(holder: ViewHolder, position: Int) { holder.bind(ch.. 2021. 5. 1.
Android] 다른 액티비티에서 프라그먼트 교체 / 뷰페이저 A프라그먼트에서 a액티비티로 화면 전환 후, a액티비티 화면에서 back 버튼으로 갔을 때 이전과 다른 B프라그먼트가 나오도록 하는 코드. #뷰페이저 두 프라그먼트는 같은 액티비티 안에 있어야 합니다. A 액티비티내 프라그먼트에서 B 액티비티로 이동 val intent = Intent(activity, B::class.java) activity?.startActivityForResult(intent, 12345) B 액티비티에서 setResult 설정 setResult(Activity.RESULT_OK) 프라그먼트를 가진 액티비티의 뷰페이저 currentItem 변경. #onActivityResult if (requestCode == 12345) { if (RESULT_OK == resultCode) {.. 2021. 4. 29.