Error in logcat:
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.os.Bundle.getString(java.lang.String)' on a null object reference at com.example.sagar.project1.profile.onCreate(profile.java:16)
Here is my profile.java
:
Bundle extras = getIntent().getExtras();
Line 16: String name = extras.getString("name");
String email = extras.getString("email");
String pass = extras.getString("pass");
String contact = extras.getString("contact");
TextView textView1 = (TextView) findViewById(R.id.txv1);
if(extras != null){
textView1.setText("Name: " +name);
}
TextView textView2 = (TextView) findViewById(R.id.tv2);
if (extras != null){
textView2.setText("Email: " +email);
}
TextView textView3 = (TextView) findViewById(R.id.tv3);
if (extras != null){
textView3.setText("Password: " +pass);
}
TextView textView4 = (TextView) findViewById(R.id.tv4);
if (extras != null){
textView4.setText("Pnone : " +contact);
}