Click here to Skip to main content
15,886,919 members
Home / Discussions / Android
   

Android

 
QuestionWhat is the correct syntax to call onCreateOptionsMenu() and onPrepareOptionsMenu() in Android Studio? Pin
priyamtheone2-Mar-24 4:39
priyamtheone2-Mar-24 4:39 
AnswerRe: What is the correct syntax to call onCreateOptionsMenu() and onPrepareOptionsMenu() in Android Studio? Pin
Richard Deeming3-Mar-24 22:03
mveRichard Deeming3-Mar-24 22:03 
GeneralRe: What is the correct syntax to call onCreateOptionsMenu() and onPrepareOptionsMenu() in Android Studio? Pin
priyamtheone30-Mar-24 7:39
priyamtheone30-Mar-24 7:39 
QuestionWeb browser design home page Pin
Bibek Poudel Nov202319-Nov-23 20:32
Bibek Poudel Nov202319-Nov-23 20:32 
AnswerRe: Web browser design home page Pin
Dave Kreskowiak20-Nov-23 3:19
mveDave Kreskowiak20-Nov-23 3:19 
GeneralRe: Web browser design home page Pin
David Crow7-Feb-24 2:18
David Crow7-Feb-24 2:18 
QuestionThe user data that I enter are not insert into the Firebase Realtime Database. Pin
alia zulaika4-Oct-23 22:45
alia zulaika4-Oct-23 22: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 4:07
Ben A Johnson24-Apr-23 4:07 
AnswerRe: Building an ecommerce app/website Pin
Richard MacCutchan24-Apr-23 4:14
mveRichard MacCutchan24-Apr-23 4:14 
GeneralRe: Building an ecommerce app/website Pin
Ben A Johnson24-Apr-23 4:42
Ben A Johnson24-Apr-23 4:42 
GeneralRe: Building an ecommerce app/website Pin
Richard MacCutchan24-Apr-23 4:49
mveRichard MacCutchan24-Apr-23 4:49 
GeneralRe: Building an ecommerce app/website Pin
Ben A Johnson24-Apr-23 6:26
Ben A Johnson24-Apr-23 6:26 
GeneralRe: Building an ecommerce app/website Pin
Richard MacCutchan24-Apr-23 6:29
mveRichard MacCutchan24-Apr-23 6:29 
AnswerRe: Building an ecommerce app/website Pin
jschell25-Apr-23 11:07
jschell25-Apr-23 11:07 
GeneralRe: Building an ecommerce app/website Pin
Ben A Johnson25-Apr-23 20:47
Ben A Johnson25-Apr-23 20:47 
GeneralRe: Building an ecommerce app/website Pin
jschell26-Apr-23 6:10
jschell26-Apr-23 6:10 
GeneralRe: Building an ecommerce app/website Pin
Ben A Johnson27-Apr-23 23:32
Ben A Johnson27-Apr-23 23:32 
GeneralRe: Building an ecommerce app/website Pin
Richard MacCutchan27-Apr-23 23:35
mveRichard MacCutchan27-Apr-23 23:35 
GeneralRe: Building an ecommerce app/website Pin
Ben A Johnson28-Apr-23 1:55
Ben A Johnson28-Apr-23 1:55 
GeneralRe: Building an ecommerce app/website Pin
Richard MacCutchan28-Apr-23 2:02
mveRichard MacCutchan28-Apr-23 2:02 
GeneralRe: Building an ecommerce app/website Pin
jschell28-Apr-23 11:17
jschell28-Apr-23 11:17 
GeneralRe: Building an ecommerce app/website Pin
Richard MacCutchan28-Apr-23 20:55
mveRichard MacCutchan28-Apr-23 20:55 
GeneralRe: Building an ecommerce app/website Pin
David Crow29-Apr-23 11:48
David Crow29-Apr-23 11:48 
GeneralRe: Building an ecommerce app/website Pin
Richard MacCutchan29-Apr-23 22:03
mveRichard MacCutchan29-Apr-23 22:03 
GeneralRe: Building an ecommerce app/website Pin
Ben A Johnson2-May-23 2:10
Ben A Johnson2-May-23 2:10 

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.