[Solved] Log statement giving error on printing the value of Intent in android


build the Intent alike this:

Intent intent = new Intent(activity, UserActivity.class);
Bundle extras = new Bundle();

extras.putString("Email", email.getText().toString().trim());
extras.putString("Name", name_db);
extras.putString("User_Id", user_id_db);
extras.putString("Contact", contact_db);

intent.putExtras(extras);
startActivity(intent);

while the List<String> contactNumber = db.getContactNumber() already seems unfortunate.

it might be rather elegant to return some class Contact (to be defined) instead of a List<String>

… so that one does not have to use index-access for getting the details.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if(this.getIntent() != null) {
        String email = this.getIntent().getStringExtra("Email");
        Log.d("UserActivity", email);
    }
}

3

solved Log statement giving error on printing the value of Intent in android