작성
·
298
0
잠시 응용해봤는데요
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"
}
}
해야 지만 게시글이 들어 가지더라구요
참 왜 그러는지 잘 모루겠습니다.
한번 살펴 봐 주시면 정말 감사하겠습니다.
네, 안되네용 ㅠ.ㅠ
에러 표시
W/RepoOperation: setValue at /userInfo/Imdae/null/-NQmr3Ih8gBSj9BuZFz6 failed: DatabaseError: Permission denied
그리고 Logcat 부분에서는
at com.example.mymemul.IntroActivity.onCreate$lambda$1(IntroActivity.kt:26)
부분이 에러가 떠서 봤는데요
부분 같더라구요
혹시 몰라서 Intro부분 전체 코드 올려 보아요
어떤게 잘못 됬을지 흠.. .. 어렵네요