Click here to Skip to main content
15,850,921 members
Home / Discussions / Android
   

Android

 
QuestionWhat is the correct syntax to call onCreateOptionsMenu() and onPrepareOptionsMenu() in Android Studio? Pin
priyamtheone2-Mar-24 5:39
priyamtheone2-Mar-24 5:39 
AnswerRe: What is the correct syntax to call onCreateOptionsMenu() and onPrepareOptionsMenu() in Android Studio? Pin
Richard Deeming5mins ago
mveRichard Deeming5mins ago 
QuestionWeb browser design home page Pin
Bibek Poudel Nov202319-Nov-23 21:32
Bibek Poudel Nov202319-Nov-23 21:32 
AnswerRe: Web browser design home page Pin
Dave Kreskowiak20-Nov-23 4:19
mveDave Kreskowiak20-Nov-23 4:19 
GeneralRe: Web browser design home page Pin
David Crow7-Feb-24 3:18
David Crow7-Feb-24 3:18 
QuestionThe user data that I enter are not insert into the Firebase Realtime Database. Pin
alia zulaika4-Oct-23 23:45
alia zulaika4-Oct-23 23:45 
Everything is good, but when I enter the data, it says the "Sign Up successfully" but when I check there's no update on the Firebase Realtime Database. There are Android Manifest.xml and SignUp.java code.
Can anyone help me ?

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
="" xmlns:tools="http://schemas.android.com/tools" package="com.example.projectfyp">

<uses-permission android:name="android.permission.INTERNET">

<application
android:allowbackup="true"
="" android:dataextractionrules="@xml/data_extraction_rules" android:fullbackupcontent="@xml/backup_rules" android:icon="@mipmap/ic_launcher" android:label="QuizzyWonders" android:roundicon="@mipmap/ic_launcher_round" android:supportsrtl="true" android:theme="@style/Theme.ProjectFYP" tools:targetapi="31">

<activity
android:label="QuizzyWonders"
="" android:name=".Login" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN">
<category android:name="android.intent.category.LAUNCHER">



<activity
android:label="QuizzyWonders"
="" android:name=".SignUp" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN">
<category android:name="android.intent.category.LAUNCHER">



<activity
android:label="QuizzyWonders"
="" android:name=".content1">









SignUp.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sign_up);


//get data from edit text
email_user = findViewById(R.id.email_user);
etUName = findViewById(R.id.etUName);
etPass = findViewById(R.id.etPass);
confirm_password = findViewById(R.id.confirm_password);
btnSignUp = findViewById(R.id.btnSignUp);


btnSignUp.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//get data to string
final String email = email_user.getText().toString();
final String username = etUName.getText().toString();
final String password = etPass.getText().toString();
final String confPassword = confirm_password.getText().toString();


//ensure user fill in all the required fields
if(TextUtils.isEmpty(email)){
email_user.setError("Email cannot be empty!");
email_user.requestFocus();

}else if(TextUtils.isEmpty(username)){
etUName.setError("Username cannot be empty!");
etUName.requestFocus();

}else if(TextUtils.isEmpty(password)){
etPass.setError("Password cannot be empty!");
etPass.requestFocus();

}else if(TextUtils.isEmpty(confPassword)){
confirm_password.setError("Please enter your confirmation password!");
confirm_password.requestFocus();

} else if (!password.equals(confPassword)) {
Toast.makeText(getApplicationContext(), "The passwords are not match!", Toast.LENGTH_SHORT).show();

}else {
databaseReference.child("Users").addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
//check if username is not registered before
if(snapshot.hasChild(username)){
Toast.makeText(getApplicationContext(), "Username is already registered!", Toast.LENGTH_SHORT).show();
}else {


//username as unique identity of every user
databaseReference.child("Users").child("UserName").setValue(username);
databaseReference.child("Users").child("UserPassword").setValue(password);

Toast.makeText(getApplicationContext(), "User sign up succesfully!", Toast.LENGTH_SHORT).show();
finish();
}
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
Toast.makeText(getApplicationContext(), ""+error.getMessage(), Toast.LENGTH_SHORT).show();
}
});
}
}
});
}
Java



QuestionBuilding an ecommerce app/website Pin
Ben A Johnson24-Apr-23 5:07
Ben A Johnson24-Apr-23 5:07 
AnswerRe: Building an ecommerce app/website Pin
Richard MacCutchan24-Apr-23 5:14
mveRichard MacCutchan24-Apr-23 5:14 
GeneralRe: Building an ecommerce app/website Pin
Ben A Johnson24-Apr-23 5:42
Ben A Johnson24-Apr-23 5:42 
GeneralRe: Building an ecommerce app/website Pin
Richard MacCutchan24-Apr-23 5:49
mveRichard MacCutchan24-Apr-23 5:49 
GeneralRe: Building an ecommerce app/website Pin
Ben A Johnson24-Apr-23 7:26
Ben A Johnson24-Apr-23 7:26 
GeneralRe: Building an ecommerce app/website Pin
Richard MacCutchan24-Apr-23 7:29
mveRichard MacCutchan24-Apr-23 7:29 
AnswerRe: Building an ecommerce app/website Pin
jschell25-Apr-23 12:07
jschell25-Apr-23 12:07 
GeneralRe: Building an ecommerce app/website Pin
Ben A Johnson25-Apr-23 21:47
Ben A Johnson25-Apr-23 21:47 
GeneralRe: Building an ecommerce app/website Pin
jschell26-Apr-23 7:10
jschell26-Apr-23 7:10 
GeneralRe: Building an ecommerce app/website Pin
Ben A Johnson28-Apr-23 0:32
Ben A Johnson28-Apr-23 0:32 
GeneralRe: Building an ecommerce app/website Pin
Richard MacCutchan28-Apr-23 0:35
mveRichard MacCutchan28-Apr-23 0:35 
GeneralRe: Building an ecommerce app/website Pin
Ben A Johnson28-Apr-23 2:55
Ben A Johnson28-Apr-23 2:55 
GeneralRe: Building an ecommerce app/website Pin
Richard MacCutchan28-Apr-23 3:02
mveRichard MacCutchan28-Apr-23 3:02 
GeneralRe: Building an ecommerce app/website Pin
jschell28-Apr-23 12:17
jschell28-Apr-23 12:17 
GeneralRe: Building an ecommerce app/website Pin
Richard MacCutchan28-Apr-23 21:55
mveRichard MacCutchan28-Apr-23 21:55 
GeneralRe: Building an ecommerce app/website Pin
David Crow29-Apr-23 12:48
David Crow29-Apr-23 12:48 
GeneralRe: Building an ecommerce app/website Pin
Richard MacCutchan29-Apr-23 23:03
mveRichard MacCutchan29-Apr-23 23:03 
GeneralRe: Building an ecommerce app/website Pin
Ben A Johnson2-May-23 3:10
Ben A Johnson2-May-23 3:10 
GeneralRe: Building an ecommerce app/website Pin
Richard MacCutchan2-May-23 3:13
mveRichard MacCutchan2-May-23 3:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.