I have this code at Main_Screen.class:
Intent add_user = new Intent(Main_Screen.this, Add_Update_User.class);
add_user.putExtra("called", "add");
add_user.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(add_user);
finish();
What I understood is that I'm sending to "Add_Update_User.class" the string "add" stored in "called" and the flags"
Now, I have this code at "Add_Update_User.class":
String called_from = getIntent().getStringExtra("called");
if (called_from.equalsIgnoreCase("add"))
{
add_view.setVisibility(View.VISIBLE);
update_view.setVisibility(View.GONE);
}
else
{
update_view.setVisibility(View.VISIBLE);
add_view.setVisibility(View.GONE);
USER_ID = Integer.parseInt(getIntent().getStringExtra("USER_ID"));
Contact c = dbHandler.Get_Contact(USER_ID);
add_name.setText(c.getName());
add_mobile.setText(c.getPhoneNumber());
add_email.setText(c.getEmail());
What I understood in "Add_Update_User.class" I'm getting the values sent from "Main_Screen.class" in the Intent, storing the value "add" in the String "called_from" and then it compares "called from" with the string "add" and if the comparison is true the view goes visible and gone but if it's not true then set the visibilities of the view AND HERE GOES MY QUESTION:
WHAT THE HELL DOES THIS PART OF THE CODE?
USER_ID = Integer.parseInt(getIntent().getStringExtra("USER_ID"));
Aucun commentaire:
Enregistrer un commentaire