소개
게시글
질문&답변
리스트뷰 아이템 클릭 잘 안되네요.ㅠ.ㅠ
구글링 열심히 해도 찾기가 힘드네요.. 잘 안되네요..ㅠ.ㅠ
- 0
- 4
- 323
질문&답변
리스트뷰 아이템 클릭 잘 안되네요.ㅠ.ㅠ
ImdaeListActivityimport android.content.Intent import android.os.Bundle import android.util.Log import androidx.appcompat.app.AppCompatActivity import androidx.databinding.DataBindingUtil import com.example.mymemul.ListTextView.ImdaeListModel import com.example.mymemul.R import com.example.mymemul.Todo.ImdaeListRvAdapter import com.example.mymemul.databinding.ActivityImdaeListBinding import com.example.mymemul.util.FBAuth import com.example.mymemul.util.FBRef import com.google.firebase.auth.FirebaseAuth import com.google.firebase.auth.ktx.auth import com.google.firebase.database.DataSnapshot import com.google.firebase.database.DatabaseError import com.google.firebase.database.ValueEventListener import com.google.firebase.ktx.Firebase class ImdaeListActivity : AppCompatActivity() { private lateinit var auth: FirebaseAuth private val imdaeDataList = mutableListOf() // private val ImdaeKeyList = mutableListOf() private val TAG = ImdaeListActivity::class.java.simpleName private lateinit var binding: ActivityImdaeListBinding private lateinit var imdaeListAdapter: ImdaeListRvAdapter override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) binding = DataBindingUtil.setContentView(this, R.layout.activity_imdae_list) binding = ActivityImdaeListBinding.inflate(layoutInflater) val view = binding.root setContentView(view) auth = Firebase.auth binding.imdaeListBtn.setOnClickListener { val intent = Intent(this, ImdaeSaActivity::class.java) startActivity(intent) } imdaeListAdapter = ImdaeListRvAdapter(imdaeDataList) binding.imdaeListView.adapter = imdaeListAdapter binding.imdaeListView.setOnItemClickListener { parent, view, position, id -> val intent = Intent(context, ImdaeSsbActivity::class.java) startActivity(intent) } //임대 리스트 getImdaeListData() } private fun getImdaeListData() { val postListener = object : ValueEventListener { override fun onDataChange(datasnapshot: DataSnapshot) { imdaeDataList.clear() for (dataModel in datasnapshot.children) { Log.d(TAG, dataModel.toString()) val item = dataModel.getValue(ImdaeListModel::class.java) imdaeDataList.add(item!!) // ImdaeKeyList.add(dataModel.key.toString()) } imdaeListAdapter.notifyDataSetChanged() } override fun onCancelled(databaseError: DatabaseError) { Log.w(TAG, "loadPost:onCancelled", databaseError.toException()) } } var uid = FBAuth.getUid() FBRef.user .child("Imdae") .child(uid) .addValueEventListener(postListener) } }ImdaeSaActivityclass ImdaeSaActivity : AppCompatActivity() { private val TAG = ImdaeSaActivity::class.java.simpleName private lateinit var auth: FirebaseAuth private var mEtAddress: EditText? = null // private val data = arrayListOf() 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 = ActivityImdaeListBinding.inflate(layoutInflater) // val view = binding.root // setContentView(view) binding.imdaeBtn.setOnClickListener { val uid = auth.currentUser?.uid.toString() val mulgun = binding.mulgunall.text.toString() 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 bojung = binding.bojung.text.toString() val worldse = binding.worldse.text.toString() val kwanry1 = binding.kwanry1.text.toString() val kwanry2 = binding.kwanry2.text.toString() val mjbb = binding.myungjuk.text.toString() val cgbb = binding.chunggo.text.toString() val time = FBAuth.getTime() Log.d(TAG, sename) Log.d(TAG, sephone) FBRef.user .child("Imdae") .child(uid) .push() .setValue( ImdaeitemModel(mulgun,sename,sephone,address,address1, bojung,worldse,kwanry1,kwanry2,mjbb,cgbb, time) ) Toast.makeText(this,"임대자료 입력완료", Toast.LENGTH_LONG).show() finish() } } }ImdaeListRvAdapterclass ImdaeListRvAdapter (val imdaeDataList : MutableList) : BaseAdapter() { override fun getCount(): Int { return imdaeDataList.size } override fun getItem(position: Int): Any { return imdaeDataList[position] } override fun getItemId(position: Int): Long { return position.toLong() } override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View { var view = convertView if (view == null) { view = LayoutInflater.from(parent?.context).inflate(R.layout.activity_imdae_list_adapter,parent, false) } val mulgun = view?.findViewById(R.id.mul) val sename = view?.findViewById(R.id.sename12) mulgun!!.text = imdaeDataList[position].mulgun sename!!.text = imdaeDataList[position].sename return view!! } }ImdaeListModelclass ImdaeListModel ( val mulgun: String = "", val sename: String = "", )activity_imdae_list activity_imdae_ssb
- 0
- 4
- 323
질문&답변
게시글읽기 공부하고 있는데요
해결 됬습니다. 신경써주셔서 감사합니다.이부분이 문제 였네요.. ^^ ㅎㅎFBRef.user .child("Imdae") .child(uid) .addValueEventListener(postListener)
- 0
- 3
- 352
질문&답변
게시글읽기 공부하고 있는데요
응용해서 만들어보고 있는데요RVadapterclass ImdaeListRvAdapter (val imdaeDataList : MutableList) : BaseAdapter() { override fun getCount(): Int { return imdaeDataList.size } override fun getItem(position: Int): Any { return imdaeDataList[position] } override fun getItemId(position: Int): Long { return position.toLong() } override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View { var view = convertView if (view == null) { view = LayoutInflater.from(parent?.context).inflate(R.layout.activity_imdae_list_adapter,parent, false) } val sename = view?.findViewById(R.id.sename12) val sephone = view?.findViewById(R.id.sephone12) val address = view?.findViewById(R.id.imdaeaddress22) val kwanly = view?.findViewById(R.id.imdaekwan11) val bojung = view?.findViewById(R.id.imdaebo11) val worlse = view?.findViewById(R.id.imdaeworl11) val mjbb = view?.findViewById(R.id.imdaemyung11) sename!!.text = imdaeDataList[position].sename sephone!!.text = imdaeDataList[position].sephone address!!.text = imdaeDataList[position].address kwanly!!.text = imdaeDataList[position].kwanry bojung!!.text = imdaeDataList[position].bojung worlse!!.text = imdaeDataList[position].worldse mjbb!!.text = imdaeDataList[position].mjbb return view!! } }ListActivityclass ImdaeListActivity : AppCompatActivity() { private lateinit var auth: FirebaseAuth private val imdaeDataList = mutableListOf() private val TAG = ImdaeListActivity::class.java.simpleName private lateinit var binding: ActivityImdaeListBinding private lateinit var imdaeListAdapter : ImdaeListRvAdapter override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) binding = DataBindingUtil.setContentView(this, R.layout.activity_imdae_list) auth = Firebase.auth binding.imdaeListBtn.setOnClickListener { val intent = Intent(this, ImdaeSaActivity::class.java) startActivity(intent) } imdaeListAdapter = ImdaeListRvAdapter(imdaeDataList) binding.imdaeListView.adapter = imdaeListAdapter //임대 리스트 getImdaeListData() } private fun getImdaeListData(){ val postListener = object : ValueEventListener { override fun onDataChange(datasnapshot: DataSnapshot) { imdaeDataList.clear() for (dataModel in datasnapshot.children) { Log.d(TAG, dataModel.toString()) val item = dataModel.getValue(ImdaeListModel::class.java) imdaeDataList.add(item!!) } imdaeListAdapter.notifyDataSetChanged() Log.d(TAG, imdaeDataList.toString()) } override fun onCancelled(databaseError: DatabaseError) { Log.w(TAG, "loadPost:onCancelled", databaseError.toException()) } } FBRef.user.addValueEventListener(postListener) } } ListModelclass ImdaeListModel ( val sename: String = "", val sephone: String = "", val address: String = "", val address1: String = "", val kwanry: String = "", val bojung: String = "", val worldse: String = "", val mjbb: String = "", )FBRefclass FBRef { companion object { private val database = Firebase.database val user = database.getReference("userInfo") } } 스크린샷(사진)열심히 살펴봤는데 원인을 알수가 없네요...ㅠ.ㅠ
- 0
- 3
- 352
질문&답변
안드로이드 스튜디오에서 엔터키 줄바꿈 안됨
감사합니다. 이전버전으로 설치후 잘되네요^^
- 0
- 3
- 1.7K
질문&답변
안드로이드 스튜디오에서 엔터키 줄바꿈 안됨
아니요 말그대로 엔터키 가 전혀 먹지를 않습니다.아무런 증상도 안나타 나구요시프트+엔터 를 하면 줄바꿈이 되더라구요시프트 엔터 계속 눌러야 하고 알트+엔터에서 나오는 메뉴도 엔터를 쳐서 코딩 코드를 넣는 것도 코드가 뜨면 마우스로 클릭해야 될정도로너무 힘드네요.. 불편하구요. ㅠ.ㅠ
- 0
- 3
- 1.7K
질문&답변
auth 오류
(사진)이부분에서 계속 오류가나네요.. 도와주세요 ㅠ위에는 오류나는부분이구요밑에는 전체 코드 입니다binding = DataBindingUtil.setContentView(this,R.layout.activity_intro)import android.content.Intent import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import androidx.databinding.DataBindingUtil import androidx.databinding.ViewDataBinding import com.chung.mymemul.databinding.ActivityIntroBinding class IntroActivity : AppCompatActivity() { private lateinit var binding: ActivityIntroBinding override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) // setContentView(R.layout.activity_intro) binding = DataBindingUtil.setContentView(this,R.layout.activity_intro) binding.loginBtn.setOnClickListener { val intent = Intent(this, LoginActivity::class.java) startActivity(intent) } binding.joinBtn.setOnClickListener { val intent = Intent(this, JoinActivity::class.java) startActivity(intent) } } }
- 0
- 5
- 560