35,200원
다른 수강생들이 자주 물어보는 질문이 궁금하신가요?
- 미해결[초급편] 안드로이드 커뮤니티 앱 만들기(Android Kotlin)
회원가입을 하면 no로 나옵니다
gradle - project// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { google() mavenCentral() } dependencies { classpath 'com.google.gms:google-services:4.3.15' } } plugins { id 'com.android.application' version '8.0.1' apply false id 'com.android.library' version '8.0.1' apply false id 'org.jetbrains.kotlin.android' version '1.8.20' apply false }gradle - appplugins { id 'com.android.application' id 'org.jetbrains.kotlin.android' id 'com.google.gms.google-services' } android { namespace 'com.example.myapplication' compileSdk 33 defaultConfig { applicationId "com.example.myapplication" minSdk 24 targetSdk 33 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = '1.8' } } dependencies { implementation 'androidx.core:core-ktx:1.8.0' implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'com.google.android.material:material:1.5.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' implementation platform('com.google.firebase:firebase-bom:32.0.0') implementation 'com.google.firebase:firebase-analytics-ktx' implementation 'com.google.firebase:firebase-auth-ktx' }MainActivitypackage com.example.myapplication import android.content.ContentValues.TAG import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.util.Log import android.widget.Button import android.widget.Toast import com.google.firebase.auth.FirebaseAuth import com.google.firebase.auth.ktx.auth import com.google.firebase.ktx.Firebase class MainActivity : AppCompatActivity() { private lateinit var auth: FirebaseAuth override fun onCreate(savedInstanceState: Bundle?) { auth = Firebase.auth super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) val joinBtnClicked=findViewById<Button>(R.id.joinBtn) joinBtnClicked.setOnClickListener { auth.createUserWithEmailAndPassword("asd@asd.com", "12341234") .addOnCompleteListener(this) { task -> if (task.isSuccessful) { Toast.makeText(this,"ok",Toast.LENGTH_SHORT).show() } else { Toast.makeText(this,"no",Toast.LENGTH_SHORT).show() Log.e(TAG, "createUserWithEmail:failure", task.exception) } } } } }
- 미해결[초급편] 안드로이드 커뮤니티 앱 만들기(Android Kotlin)
xml에 아무리 찾아도 오류가 없는데 이상합니다
Execution failed for task ':app:extractDeepLinksDebug'. > org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog. 오류가 뜨는데 구글링 chatgpt 통해서 알아봐도 아무리 봐도 xml오류가 없습니다..6시간째 찾는중인데 도와주세요 ㅠㅠ
- 미해결[초급편] 안드로이드 커뮤니티 앱 만들기(Android Kotlin)
Toastmasage가 뜨지 않고 이메일 저장도 안돼요
수업 들으면서 그대로 따라했다고 생각했는데 회원가입 버튼을 누르면 토스트메시지도 뜨지않고 데이터도 파이어베이스에 저장이 안되어있네요build.gradle -project// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { google() mavenCentral() } dependencies { classpath 'com.google.gms:google-services:4.3.15' } } plugins { id 'com.android.application' version '7.3.0' apply false id 'com.android.library' version '7.3.0' apply false id 'org.jetbrains.kotlin.android' version '1.7.10' apply false } build.gradle -appplugins { id 'com.android.application' id 'org.jetbrains.kotlin.android' id 'com.google.gms.google-services' } android { namespace 'com.mysampleapp' compileSdk 33 defaultConfig { applicationId "com.mysampleapp" minSdk 28 targetSdk 33 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = '1.8' } } dependencies { implementation 'androidx.core:core-ktx:1.7.0' implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'com.google.android.material:material:1.9.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' implementation platform('com.google.firebase:firebase-bom:32.0.0') implementation 'com.google.firebase:firebase-analytics-ktx' implementation 'com.google.firebase:firebase-auth-ktx' }MainActivitypackage com.mysampleapp import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.widget.Button import android.widget.Toast import com.google.firebase.auth.FirebaseAuth import com.google.firebase.auth.ktx.auth import com.google.firebase.ktx.Firebase class MainActivity : AppCompatActivity() { private lateinit var auth: FirebaseAuth override fun onCreate(savedInstanceState: Bundle?) { auth = Firebase.auth super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) val joinBtnClicked=findViewById<Button>(R.id.joinBtn) joinBtnClicked.setOnClickListener {auth.createUserWithEmailAndPassword("abc@abc.com", "12345678") .addOnCompleteListener(this) { task -> if (task.isSuccessful) { Toast.makeText(this,"ok",Toast.LENGTH_SHORT).show() } else { Toast.makeText(this,"no",Toast.LENGTH_SHORT).show() } } } } }
- 미해결[초급편] 안드로이드 커뮤니티 앱 만들기(Android Kotlin)
프로젝트 생성하고 이런 문구가 뜨면 어떡하나요?
- 미해결[초급편] 안드로이드 커뮤니티 앱 만들기(Android Kotlin)
firebase, auth import문제
안녕하세요 강의 영상과 같이 build.gradle에 파이어베이스 연결과 관련해서 모두 복사 붙여넣기를 한 후 joinactivity에서 진행하는 다음 과정을 따라하고 있는데 Firebaseauth는 import가 되는데Firebase와 auth가 import가 되지가 않습니다 이 부분을 어떻게 해결해야할까요? 직접 import문을 작성해보았는데도 빨간줄이 나오면서 해결이 되지가 않습니다
- 해결됨[초급편] 안드로이드 커뮤니티 앱 만들기(Android Kotlin)
북마크 탭에서 북마크 취소 시 문제
안녕하세요. 북마크 진행하다가 북마크 탭에서 북마크를 삭제하는 부분에서 문제가 생겨 질문 올립니다.아래 상태에서북마크를 취소하기위해 클릭하면이렇게 제가 누른 부분은 사라지지만(이 부분은 제가 클릭했을 때 bookmarkIdList에 KeyList가 없다면 사라지게 해놓은 겁니다) 또 중복으로 아이템이 생깁니다. 계속 시도해봤는데 어디서 고쳐야할지 잘 모르겠습니다.아래는 BookmarkRVAdapter.kt의 코드입니다. 편하실 때 답변해주시면 감사하겠습니다!package com.bokchi.mysolelife.contentsList import android.content.Context import android.content.Intent import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.ImageView import android.widget.TextView import androidx.recyclerview.widget.RecyclerView import com.bokchi.mysolelife.R import com.bokchi.mysolelife.utils.FBAuth import com.bokchi.mysolelife.utils.FBRef import com.bumptech.glide.Glide class BookmarkRVAdapter(val context : Context, val items : ArrayList<ContentModel>, val keyList : ArrayList<String>, val bookmarkIdList : MutableList<String> ) : RecyclerView.Adapter<BookmarkRVAdapter.Viewholder>() { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BookmarkRVAdapter.Viewholder { val v = LayoutInflater.from(parent.context).inflate(R.layout.content_rv_item, parent, false) Log.d("RVAdapterB", "key List : " + keyList.toString()) Log.d("RVAdapterB","Bookmark List : " + bookmarkIdList.toString()) return Viewholder(v) } override fun onBindViewHolder(holder: BookmarkRVAdapter.Viewholder, position: Int) { holder.bindItems(items[position], keyList[position]) } override fun getItemCount(): Int { return items.size } inner class Viewholder(itemView : View) : RecyclerView.ViewHolder(itemView) { fun bindItems(item : ContentModel, key : String) { itemView.setOnClickListener { val intent = Intent(context, ContentShowActivity::class.java) intent.putExtra("url", item.webUrl) itemView.context.startActivity(intent) } val ContentTitle = itemView.findViewById<TextView>(R.id.TextArea) val imageViewArea = itemView.findViewById<ImageView>(R.id.imageArea) val bookmarkArea = itemView.findViewById<ImageView>(R.id.BookmarkArea) if(bookmarkIdList.contains(key)) { // bookmarkIdList가 KeyList에 있는 정보를 가지고 있다면 bookmarkArea.setImageResource(R.drawable.bookmark_color) } else { bookmarkArea.setImageResource(R.drawable.bookmark_white) } ContentTitle.text = item.title Glide.with(context) .load(item.imageUrl) .into(imageViewArea) bookmarkArea.setOnClickListener { // 북마크를 누르면 실행되는 내용 // 북마크를 클릭했을 때, 북마크가 있는 경우 -> 북마크 삭제 if(bookmarkIdList.contains(key)) { ContentTitle.visibility = View.GONE imageViewArea.visibility = View.GONE bookmarkArea.visibility = View.GONE FBRef.bookmarkRef .child(FBAuth.getUid()) .child(key) .removeValue() } } if(bookmarkIdList.isEmpty()) { ContentTitle.visibility = View.GONE imageViewArea.visibility = View.GONE bookmarkArea.visibility = View.GONE } Log.e("BOOKMARK", bookmarkIdList.toString()) } } }
- 미해결[초급편] 안드로이드 커뮤니티 앱 만들기(Android Kotlin)
안드로이드 스튜디오 자바 코틀린 혼용
강의 외 내용입니다만..안드로이드 스튜디오에서 자바랑 코틀린 코드를 같이 사용 할 수 있는 방법이 없을까요?구글링해도 중간 과정 생략된 방법들이랑 저의 플러그인 속에서는 코틀린이 installed 되어있는거 같은데 버전 확인도 안됩니다..상대는 자바 전 코틀린으로 프로젝트 진행하려고 했는데같은 프로젝트에서 자바랑 코틀린 같이 사용 할 수 있는지 궁금하고 가능하면 방법도 궁금합니다.. 6시간 넘게 찾고 있는데 다 안되거나 과정 생략이네요..코틀린에 있는 var : 이런거랑 자바에서 쓰이는 ; 세미콜론 같은걸 하나의 액티브 클래스?파일에서 사용가능한지 궁금합니다윗줄 var : 어쩌구아랫줄 자바 어쩌구 ; 이 가능한지요
- 미해결[초급편] 안드로이드 커뮤니티 앱 만들기(Android Kotlin)
파이어베이스
로그인 회원가입 파이어베이스 하는데gradle 에 버전이 호환되지 않는다구 떠요 버전 설정은 어떻게 해야할까요
- 미해결[초급편] 안드로이드 커뮤니티 앱 만들기(Android Kotlin)
로그인 버튼 눌렀는데 다음 화면으로 안넘어가고 앱이 종료돼요
선생님이 보고 똑같이 따라했는데 안되네요,, 앱에 버그가 있어 앱을 종료했다고만 떠요
- 미해결[초급편] 안드로이드 커뮤니티 앱 만들기(Android Kotlin)
게시물 넘버링
한개 만 알려주시면 안될까요게시글 생성될때마다 게시물 넘버링 1, 2 , 3 이런식으로 넘버링 자동생성 넣고 싶은데 코드좀 알려주시면 안될까요.. 한번만 부탁드립니다. ^^
- 미해결[초급편] 안드로이드 커뮤니티 앱 만들기(Android Kotlin)
intent flags가 먹지 않습니다.
val intent = Intent(this, MainActivity::class.java) intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP startActivity(intent) 영상에서 뒤로가기를 해도 강사님처럼 앱이 종료되는 것이 아닌 기존 페이지가 다시 나타납니다.
- 미해결[초급편] 안드로이드 커뮤니티 앱 만들기(Android Kotlin)
리스트뷰 아이템 클릭 잘 안되네요.ㅠ.ㅠ
게시글 보기 페이지 공부하고 있어요응용해서 만들고 있는데요리스트뷰 아이템 글릭 코딩에서 에러가 나와요context이부분이 계속 빨간색으로 나오더라구요import 해도 저렇게 뜨구요problems 에서는Unresolved reference : context이렇게 뜨네요.. 흠.. 잘모루겠어요도와주세요
- 미해결[초급편] 안드로이드 커뮤니티 앱 만들기(Android Kotlin)
게시글읽기 공부하고 있는데요
저는 리스트가 여러개 있는데 리스트뷰목록이 1개밖에 안뜨네요 흠.. 왜 그럴까요? 도와주세요
- 미해결[초급편] 안드로이드 커뮤니티 앱 만들기(Android Kotlin)
이미지도 수정하고 싶어서 수정을 해봤습니다.
BoardWriteActivity 부분에 있던 이미지를 넣는 코드들(imageUpload 함수, onActivityResult 함수)을 그대로 복사해서 BoardEditActivity에 붙여넣기를 했습니다. 수정 화면에서 이미지를 클릭했을 때 기존 WriteActivity에서 이미지를 추가했을 때와 같이 나오고에러도 없이 실행이 되는데 이렇게 하는게 맞는건가 싶어서 질문드립니다! package com.example.mysolelife.board import android.content.Intent import android.graphics.Bitmap import android.graphics.drawable.BitmapDrawable import android.os.Bundle import android.provider.MediaStore import android.util.Log import android.widget.Toast import androidx.appcompat.app.AppCompatActivity import androidx.databinding.DataBindingUtil import com.bumptech.glide.Glide import com.example.mysolelife.R import com.example.mysolelife.databinding.ActivityBoardEditBinding import com.example.mysolelife.utils.FBAuth import com.example.mysolelife.utils.FBRef import com.google.android.gms.tasks.OnCompleteListener import com.google.firebase.database.DataSnapshot import com.google.firebase.database.DatabaseError import com.google.firebase.database.ValueEventListener import com.google.firebase.ktx.Firebase import com.google.firebase.storage.ktx.storage import java.io.ByteArrayOutputStream class BoardEditActivity : AppCompatActivity() { private lateinit var key: String private lateinit var binding: ActivityBoardEditBinding private val TAG = BoardEditActivity::class.java.simpleName private lateinit var writerUid: String private var isImageUpload = false override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) binding = DataBindingUtil.setContentView(this, R.layout.activity_board_edit) key = intent.getStringExtra("key").toString() getBoardData(key) getImageData(key) binding.editBtn.setOnClickListener { editBoardData(key) if (isImageUpload) { imageUpload(key) } } binding.imageArea.setOnClickListener { val gallery = Intent(Intent.ACTION_PICK, MediaStore.Images.Media.INTERNAL_CONTENT_URI) startActivityForResult(gallery, 100) isImageUpload = true } } private fun editBoardData(key: String) { // 게시글 t FBRef.boardRef .child(key) .setValue( BoardModel( binding.titleArea.text.toString(), binding.contentArea.text.toString(), writerUid, FBAuth.getTime() ) ) Toast.makeText(this, "수정완료", Toast.LENGTH_LONG).show() finish() } private fun imageUpload(key: String) { // Get the data from an ImageView as bytes val storage = Firebase.storage // Create a storage reference from our app val storageRef = storage.reference // Create a reference to "mountains.jpg" val mountainsRef = storageRef.child("${key}.png") val imageView = binding.imageArea imageView.isDrawingCacheEnabled = true imageView.buildDrawingCache() val bitmap = (imageView.drawable as BitmapDrawable).bitmap val baos = ByteArrayOutputStream() bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos) val data = baos.toByteArray() var uploadTask = mountainsRef.putBytes(data) uploadTask.addOnFailureListener { // Handle unsuccessful uploads }.addOnSuccessListener { taskSnapshot -> // taskSnapshot.metadata contains file metadata such as size, content-type, etc. // ... } } override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) if (resultCode == RESULT_OK && requestCode == 100) { binding.imageArea.setImageURI(data?.data) } } private fun getImageData(key: String) { // Reference to an image file in Cloud Storage val storageReference = Firebase.storage.reference.child("${key}.png") // ImageView in your Activity val imageViewFromFB = binding.imageArea storageReference.downloadUrl.addOnCompleteListener(OnCompleteListener { task -> if (task.isSuccessful) { Glide.with(this) .load(task.result) .into(imageViewFromFB) } else { } }) } private fun getBoardData(key: String) { val postListener = object : ValueEventListener { override fun onDataChange(dataSnapshot: DataSnapshot) { // 데이터를 하나만 가져오면 되므로 반복문 사용이 필요 없다. val dataModel = dataSnapshot.getValue(BoardModel::class.java) Log.d(TAG, dataModel!!.title) binding.titleArea.setText(dataModel.title) binding.contentArea.setText(dataModel.content) writerUid = dataModel.uid } override fun onCancelled(databaseError: DatabaseError) { // Getting Post failed, log a message Log.w(TAG, "loadPost:onCancelled", databaseError.toException()) } } FBRef.boardRef.child(key).addValueEventListener(postListener) } }
- 미해결[초급편] 안드로이드 커뮤니티 앱 만들기(Android Kotlin)
안드로이드 스튜디오에서 엔터키 줄바꿈 안됨
한참 코딩 하다가 갑자기 줄바꿈 엔터키가 안먹네요재부팅을 해도 안되고 스튜디오 재설치해도 안되네요혹시 몰라서 다른 키보드를 바꿔 봤어도 안되네요왜 안되는지 참 난감합니다. 도와 주세요
- 미해결[초급편] 안드로이드 커뮤니티 앱 만들기(Android Kotlin)
파이어 베이스 로그인 및 회원가입 질문입니다.
.
- 미해결[초급편] 안드로이드 커뮤니티 앱 만들기(Android Kotlin)
강의 열심히 수강 하고 잘 듣고 있습니다. 잠시 응용한번 해봤는데요
잠시 응용해봤는데요class ImdaeSaActivity : AppCompatActivity() { private val TAG = ImdaeSaActivity::class.java.simpleName private lateinit var auth: FirebaseAuth private val data = arrayListOf<ImdaeTodo>() private lateinit var binding: ActivityImdaeSaBinding override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) // setContentView(R.layout.activity_imdae_sa) binding = DataBindingUtil.setContentView(this, R.layout.activity_imdae_sa) auth = Firebase.auth auth = FirebaseAuth.getInstance() binding = ActivityImdaeSaBinding.inflate(layoutInflater) val view = binding.root setContentView(view) binding.imadaeBtn.setOnClickListener { val sename = binding.sename.text.toString() val sephone = binding.sephoneno.text.toString() val address = binding.etAddress.text.toString() val address1 = binding.etAddress1.text.toString() val kwanry = binding.kwanry.text.toString() val bojung = binding.bojung.text.toString() val worldse = binding.worldse.text.toString() val mjbb = binding.myungjuk.text.toString() val cgbb = binding.chunggo.text.toString() val uid = FBAuth.getUid() val time = FBAuth.getTime() Log.d(TAG, sename) Log.d(TAG, sephone) FBRef.Imdae .push() .setValue( ImdaeitemModel( sename, sephone, address, address1, kwanry, bojung, worldse, mjbb, cgbb, uid, time ) ) } } }한번볼께요<layout> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".List.ImdaeSaActivity"> <LinearLayout android:id="@+id/linearLayout3" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#FFE3E3E3" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:layout_marginTop="10dp" android:layout_marginRight="10dp" android:layout_marginBottom="10dp" android:gravity="center|center_horizontal" android:background="@drawable/mocer_call_yello_title" android:orientation="horizontal"> <TextView android:id="@+id/imdaetitle" android:layout_width="wrap_content" android:layout_height="50dp" android:gravity="center" android:text="임대등록 하세요" android:textSize="20sp" android:textStyle="bold" /> <EditText android:id="@+id/imdaeData" android:layout_width="48dp" android:layout_height="wrap_content" android:gravity="center" android:text="날자" android:textSize="20sp"/> </LinearLayout> <androidx.core.widget.NestedScrollView android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:layout_marginBottom="10dp" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="5dp" android:background="@drawable/mocer_call_mulback" android:orientation="horizontal"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="10dp" android:orientation="horizontal"> <LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:layout_marginTop="5dp" android:layout_marginRight="5dp" android:layout_marginBottom="5dp" android:gravity="left" android:text="물전종류" android:textSize="15sp"/> </LinearLayout> <TextView android:id="@+id/mulgunall" android:layout_width="match_parent" android:layout_height="40dp" android:layout_gravity="center_vertical" android:background="@drawable/mocer_call_no" android:gravity="center_horizontal|center_vertical" android:hint="물건종류를 선택하세요" android:textSize="20sp" android:textStyle="italic" tools:ignore="SpeakableTextPresentCheck,TouchTargetSizeCheck" /> </LinearLayout> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/mocer_call" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_marginBottom="5dp" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:layout_marginTop="5dp" android:layout_marginRight="5dp" android:layout_marginBottom="5dp" android:gravity="left" android:text="연락정보" android:textSize="15sp" android:textStyle="bold" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <EditText android:id="@+id/sename" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1.7" android:background="@drawable/mocer_call_mulback1" android:hint="이름" android:paddingLeft="10dp" android:paddingTop="10dp" android:paddingBottom="10dp" android:textSize="20sp" tools:ignore="TouchTargetSizeCheck,SpeakableTextPresentCheck" /> <EditText android:id="@+id/sephoneno" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:layout_weight="1" android:background="@drawable/mocer_call_mulback1" android:hint="세입자폰번호" android:inputType="phone" android:maxLength="13" android:paddingLeft="10dp" android:paddingTop="10dp" android:paddingBottom="10dp" android:textSize="20sp" tools:ignore="TouchTargetSizeCheck,SpeakableTextPresentCheck" /> </LinearLayout> </LinearLayout> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="5dp" android:background="@drawable/mocer_call" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="left|center_vertical" android:layout_marginLeft="10dp" android:layout_marginTop="5dp" android:layout_marginRight="5dp" android:layout_marginBottom="5dp" android:gravity="center|left" android:text="주 소" android:textSize="15sp" android:textStyle="bold" /> <EditText android:id="@+id/etAddress" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_marginBottom="5dp" android:background="@drawable/mocer_call_mulback1" android:hint="주소입력하세요" android:inputType="textMultiLine" android:paddingLeft="10dp" android:paddingTop="10dp" android:paddingRight="5dp" android:paddingBottom="10dp" android:textSize="18sp" tools:ignore="TouchTargetSizeCheck,SpeakableTextPresentCheck" /> <EditText android:id="@+id/etAddress1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_marginBottom="5dp" android:background="@drawable/mocer_call_mulback1" android:hint="상세주소 입력하세요" android:inputType="textMultiLine" android:paddingLeft="10dp" android:paddingTop="10dp" android:paddingRight="5dp" android:paddingBottom="10dp" android:textSize="18sp" tools:ignore="TouchTargetSizeCheck,SpeakableTextPresentCheck" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="5dp" android:background="@drawable/mocer_call" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginLeft="5dp" android:layout_marginTop="5dp" android:layout_marginRight="5dp" android:layout_marginBottom="5dp" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:layout_width="80dp" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:layout_marginTop="5dp" android:layout_marginRight="5dp" android:layout_marginBottom="5dp" android:gravity="left" android:text="상세내용" android:textSize="15sp" android:textStyle="bold" /> <TextView android:layout_width="80dp" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:layout_marginTop="5dp" android:layout_marginRight="5dp" android:layout_marginBottom="5dp" android:gravity="left" android:text="(단위|만원)" android:textColor="#985B01" android:textSize="13sp" android:textStyle="bold" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <EditText android:id="@+id/kwanry" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_marginBottom="5dp" android:layout_weight="1" android:background="@drawable/mocer_call_mulback1" android:hint="관리비" android:inputType="number" android:paddingLeft="5dp" android:paddingTop="10dp" android:paddingRight="5dp" android:paddingBottom="10dp" android:textSize="18sp" tools:ignore="TouchTargetSizeCheck" /> <EditText android:id="@+id/bojung" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginRight="5dp" android:layout_marginBottom="5dp" android:layout_weight="1" android:background="@drawable/mocer_call_mulback1" android:hint="보증금" android:inputType="number" android:paddingLeft="5dp" android:paddingTop="10dp" android:paddingRight="5dp" android:paddingBottom="10dp" android:textSize="18sp" tools:ignore="TouchTargetSizeCheck" /> <EditText android:id="@+id/worldse" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginRight="5dp" android:layout_marginBottom="5dp" android:layout_weight="1" android:background="@drawable/mocer_call_mulback1" android:hint="월세" android:inputType="number" android:paddingLeft="5dp" android:paddingTop="10dp" android:paddingRight="5dp" android:paddingBottom="10dp" android:textSize="18sp" tools:ignore="TouchTargetSizeCheck" /> </LinearLayout> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_marginBottom="5dp" android:orientation="vertical"> <TextView android:layout_width="60dp" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:layout_marginTop="5dp" android:layout_marginRight="5dp" android:layout_marginBottom="5dp" android:gravity="left" android:text="면 적" android:textSize="15sp" android:textStyle="bold" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <EditText android:id="@+id/myungjuk" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_marginBottom="5dp" android:layout_weight="1" android:background="@drawable/mocer_call_mulback1" android:gravity="right|center" android:hint="면적" android:paddingLeft="5dp" android:paddingTop="10dp" android:paddingRight="5dp" android:paddingBottom="10dp" android:textSize="18sp" tools:ignore="TouchTargetSizeCheck,SpeakableTextPresentCheck" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="left|center_vertical" android:text="㎡" android:textSize="10sp" /> <LinearLayout android:layout_width="2dp" android:layout_height="20dp" android:layout_marginLeft="3dp" android:layout_marginTop="5dp" android:layout_marginRight="3dp" android:layout_marginBottom="5dp" android:background="@color/black" /> <EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="5dp" android:layout_marginBottom="5dp" android:layout_weight="1" android:background="@drawable/mocer_call_mulback1" android:gravity="right|center" android:hint="평수" android:paddingLeft="5dp" android:paddingTop="10dp" android:paddingRight="5dp" android:paddingBottom="10dp" android:textSize="18sp" tools:ignore="TouchTargetSizeCheck,SpeakableTextPresentCheck" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="left|center_vertical" android:text="평" android:textSize="10sp" /> <LinearLayout android:layout_width="2dp" android:layout_height="20dp" android:layout_marginLeft="3dp" android:layout_marginTop="5dp" android:layout_marginRight="3dp" android:layout_marginBottom="5dp" android:background="@color/black" /> <EditText android:id="@+id/chunggo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="5dp" android:layout_marginBottom="5dp" android:layout_weight="1" android:background="@drawable/mocer_call_mulback1" android:gravity="right|center" android:hint="층고" android:paddingLeft="5dp" android:paddingTop="10dp" android:paddingRight="5dp" android:paddingBottom="10dp" android:textSize="18sp" tools:ignore="TouchTargetSizeCheck,SpeakableTextPresentCheck" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="left|center_vertical" android:gravity="left" android:text="m" android:textSize="10sp" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="5dp" android:orientation="horizontal"> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginRight="5dp" android:layout_marginBottom="5dp" android:layout_weight="1" android:background="@drawable/mocer_call_mulback1" android:hint="방/욕실수" android:paddingLeft="5dp" android:paddingTop="10dp" android:paddingRight="5dp" android:paddingBottom="10dp" android:textSize="18sp" tools:ignore="TouchTargetSizeCheck" /> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_marginBottom="5dp" android:layout_weight="1" android:background="@drawable/mocer_call_mulback1" android:hint="총층수" android:paddingLeft="5dp" android:paddingTop="10dp" android:paddingRight="5dp" android:paddingBottom="10dp" android:textSize="18sp" tools:ignore="TouchTargetSizeCheck" /> </LinearLayout> </LinearLayout> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="5dp" android:background="@drawable/mocer_call" android:orientation="vertical"> <com.google.android.material.card.MaterialCardView android:id="@+id/layout01" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginHorizontal="10dp" android:layout_marginTop="5dp" android:outlineProvider="none" app:cardBackgroundColor="@color/white"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:text="옵 션" android:textSize="22sp" android:textStyle="bold" /> </com.google.android.material.card.MaterialCardView> <com.google.android.material.card.MaterialCardView android:id="@+id/layoutDetail01" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="5dp" android:layout_marginHorizontal="10dp" android:backgroundTint="#ffffff" android:visibility="visible" app:cardCornerRadius="15dp" app:strokeColor="#aaa" app:strokeWidth="1dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:layout_marginTop="5dp" android:layout_marginRight="5dp" android:layout_marginBottom="5dp" android:gravity="center" android:orientation="horizontal"> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical"> <EditText android:id="@+id/option" android:layout_width="200dp" android:layout_height="40dp" android:background="@drawable/mocer_call_mulback1" android:gravity="center" android:hint="옵션등록10자까지만" android:textSize="15sp" tools:ignore="TouchTargetSizeCheck" /> </LinearLayout> <Button android:id="@+id/add_button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:text="추 가" /> </LinearLayout> <androidx.recyclerview.widget.RecyclerView android:id="@+id/recycler_view" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="5dp" android:layout_marginLeft="5dp" /> </LinearLayout> </com.google.android.material.card.MaterialCardView> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="5dp" android:background="@drawable/mocer_call" android:orientation="vertical"> <com.google.android.material.card.MaterialCardView android:id="@+id/layout02" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginHorizontal="10dp" android:layout_marginTop="5dp" android:outlineProvider="none"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:text="메 모" android:textSize="22sp" android:textStyle="bold" /> <ImageButton android:id="@+id/layoutBtn02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right" android:layout_margin="10dp" android:background="@android:color/transparent" android:clickable="false" android:src="@drawable/arrow_up" android:textSize="22sp" tools:ignore="SpeakableTextPresentCheck" /> </com.google.android.material.card.MaterialCardView> <com.google.android.material.card.MaterialCardView android:id="@+id/layoutDetail02" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="5dp" android:layout_marginHorizontal="10dp" android:backgroundTint="#ffffff" android:visibility="visible" app:cardCornerRadius="15dp" app:strokeColor="#aaa" app:strokeWidth="1dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/white" android:gravity="center_horizontal" android:orientation="vertical"> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_marginBottom="5dp" android:background="@drawable/mocer_call_mulback2" android:hint="필요한 내용 있으시면 여기에 메모해 주시면 됩니다. 내용은 길게 쓰셔도 되요" /> </LinearLayout> </com.google.android.material.card.MaterialCardView> </LinearLayout> </LinearLayout> </LinearLayout> </androidx.core.widget.NestedScrollView> </LinearLayout> <Button android:id="@+id/imadaeBtn" android:layout_width="60dp" android:layout_height="60dp" android:layout_marginLeft="15dp" android:layout_marginRight="15dp" android:layout_marginBottom="15dp" android:text="입 력" android:textSize="20sp" android:background="@drawable/mocer_call_yello_button" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" /> </androidx.constraintlayout.widget.ConstraintLayout> </layout>근데 파이어베이스에 들어가보면 uid값은 null로 나오고 가져오질 못하더라구요 그리고 보안 규칙을 { "rules": { ".read": "auth.uid !== null", ".write": "auth.uid !== null" } }로 하고 로그인을 한 다음 하면 파이어베이스에 게시글이 안들어 가지고 보안규칙을{ "rules": { ".read": "true", ".write": "true" }}해야 지만 게시글이 들어 가지더라구요참 왜 그러는지 잘 모루겠습니다.한번 살펴 봐 주시면 정말 감사하겠습니다.
- 미해결[초급편] 안드로이드 커뮤니티 앱 만들기(Android Kotlin)
dataModel 에서 값을 갖고 오지 못합니다
수정 버튼을 누르고 이후에 수정하는 페이지가 나올때 binding을 통해 dataModel 값들을 불러오지 못하고 오류가 납니다 class BoardEditActivity : AppCompatActivity() { private lateinit var key:String private lateinit var binding : ActivityBoardEditBinding private val TAG = BoardEditActivity::class.java.simpleName override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) binding = DataBindingUtil.setContentView(this, R.layout.activity_board_edit) key = intent.getStringExtra("key").toString() getBoardData(key) } private fun getBoardData(key : String){ val postListener = object : ValueEventListener { override fun onDataChange(dataSnapshot: DataSnapshot) { val dataModel = dataSnapshot.getValue(BoardModel::class.java) Log.d(TAG, dataModel.toString()) // Log.d(TAG, dataModel!!.title) // Log.d(TAG, dataModel!!.time) binding.titleArea.setText(dataModel?.title) binding.contentArea.setText(dataModel?.content) } override fun onCancelled(databaseError: DatabaseError) { // Getting Post failed, log a message Log.w(TAG, "loadPost:onCancelled", databaseError.toException()) } } FBRef.boardRef.child(key).addValueEventListener(postListener) } } 이게 현재 코드입니다여기서 저번 강의때 try catch 구문 쓰셨던 것과 같은 문제가 발생합니다그래서 try catch 를 쓰면 오류가 나와 페이지로만 이동하게 되어 아무것도 표시되지 않습니다 안드로이드 스튜디오 버전은 Electric Eel 입니다
- 미해결[초급편] 안드로이드 커뮤니티 앱 만들기(Android Kotlin)
게시글 삭제 시 화면 이동
게시글 삭제했을 때 따로 화면 이동이 발생하도록 처리를 해주시지 않으셔서 삭제했을 때 게시글 목록이 있는 화면으로 넘어가도록 처리해주고 싶습니다. 이때 intent로 처리하고자 했으나 talkFragment는 액티비티가 아니라서 원하는 대로 되질 않는데 혹시 어떻게 처리해주면 되나요?
- 미해결[초급편] 안드로이드 커뮤니티 앱 만들기(Android Kotlin)
로그인 오류가 납니다.
.