Please help me, I don't know what's wrong with this code. I follow the tutorial on youtube and check the code several times but I don't know why when the profile activity appears to be blank.
note : i already added this to manifest
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
here's the code:
note : i already added this to manifest
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
here's the code:
Java:
package com.example.javaguru.Activities;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.example.javaguru.R;
import com.example.javaguru.databinding.ActivityProfileBinding;
import com.example.javaguru.databinding.ActivityQuestionBinding;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.Query;
import com.google.firebase.database.ValueEventListener;
public class ProfileActivity extends AppCompatActivity {
TextView profileName, profileEmail, profileUsername, profilePassword;
TextView titleName, titleUsername;
Button editProfile;
ActivityProfileBinding binding;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profile);
getSupportActionBar().hide();
profileName = findViewById(R.id.profileName);
profileEmail = findViewById(R.id.profileEmail);
profileUsername = findViewById(R.id.profileUsername);
profilePassword = findViewById(R.id.profilePassword);
titleName = findViewById(R.id.titleName);
titleUsername = findViewById(R.id.titleUsername);
showUserData();
}
public void showUserData(){
Intent intent = getIntent();
String nameUser = intent.getStringExtra("name");
String emailUser = intent.getStringExtra("email");
String usernameUser = intent.getStringExtra("username");
String passwordUser = intent.getStringExtra("password");
titleName.setText(nameUser);
titleUsername.setText(usernameUser);
profileName.setText(nameUser);
profileEmail.setText(emailUser);
profileUsername.setText(usernameUser);
profilePassword.setText(passwordUser);
}
}