firstly I am sorry for my bad english...
I am new in Android and I have a register page include multiple checkboxes like reading book, playing an enstrument etc. In another activity, I save user's information in Firebase Realtime Database. But I can't passing the data of checkboxes to another page.
This is the Xml code of Checkboxes.
<CheckBox
android:id="@+id/bisiklet_surmek_hobi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:background="@drawable/hobi_bisiklet_check_selector"
android:button="@color/colorTransparent"
android:fontFamily="@font/inter_bold"
android:gravity="center_horizontal|center_vertical"
android:letterSpacing="-0.03"
android:shadowColor="#000000"
android:shadowDy="3"
android:shadowRadius="10"
android:text="Bisiklet\nSürmek"
android:textColor="@color/whiteColor" />
<CheckBox
android:id="@+id/satranc_hobi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginBottom="10dp"
android:layout_toRightOf="@id/bisiklet_surmek_hobi"
android:background="@drawable/hobi_satranc_check_selector"
android:button="@null"
android:fontFamily="@font/inter_bold"
android:gravity="center_horizontal|center_vertical"
android:letterSpacing="-0.03"
android:shadowColor="#000000"
android:shadowDy="3"
android:shadowRadius="10"
android:text="Satranç"
android:textColor="@color/whiteColor" />
<CheckBox
android:id="@+id/enstruman_calmak_hobi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/satranc_hobi"
android:layout_alignLeft="@id/satranc_hobi"
android:layout_marginBottom="10dp"
android:background="@drawable/hobi_enstruman_check_selector"
android:button="@null"
android:fontFamily="@font/inter_bold"
android:gravity="center_horizontal|center_vertical"
android:letterSpacing="-0.03"
android:shadowColor="#000000"
android:shadowDy="3"
android:shadowRadius="10"
android:text="Enstrüman\nÇalmak"
android:textColor="@color/whiteColor" />
<CheckBox
android:id="@+id/cizim_yapmak_hobi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/bisiklet_surmek_hobi"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:background="@drawable/hobi_cizim_check_selector"
android:button="@null"
android:fontFamily="@font/inter_bold"
android:gravity="center_horizontal|center_vertical"
android:letterSpacing="-0.03"
android:shadowColor="#000000"
android:shadowDy="3"
android:shadowRadius="10"
android:text="Çizim Yapmak"
android:textColor="@color/whiteColor" />
I defined the checkboxes in Hobby_Activity.
bisiklet_surmek_hobi = findViewById(R.id.bisiklet_surmek_hobi);
satranc_hobi = findViewById(R.id.satranc_hobi);
enstruman_calmak_hobi = findViewById(R.id.enstruman_calmak_hobi);
cizim_yapmak_hobi = findViewById(R.id.cizim_yapmak_hobi);
kitap_okumak_hobi = findViewById(R.id.kitap_okumak_hobi);
cosplay_hobi = findViewById(R.id.cosplay_hobi);
muzik_dinlemek_hobi = findViewById(R.id.muzik_dinlemek_hobi);
And this is the Last_Activity that I saved the datas in database.I used Intent function page by page.
comp_phoneNumber = getIntent().getStringExtra("userPhone");
user_FirstName = getIntent().getStringExtra("user_FirstName");
user_Gender = getIntent().getStringExtra("user_Gender");
user_Birthdate = getIntent().getStringExtra("user_Birthdate");
This is the realtime database function. This function is working very well.
public void storeNewUserData() {
rootNode = FirebaseDatabase.getInstance();
reference = rootNode.getReference("Users");
UserHelperClass addNewUser = new UserHelperClass(comp_phoneNumber, user_FirstName, user_Gender, user_Birthdate);
reference.child(comp_phoneNumber).setValue(addNewUser);
}
But I can't passing data of the checkboxes in Last_Activity and I don't know how to save checkboxes to under the user phone number.
Thank you in advance for your help.
Aucun commentaire:
Enregistrer un commentaire