How to get values from a Textview of another Activity?

Asked

Viewed 49 times

-1

I would like to get the email that was typed on the login screen and with this value pass to another Activity.

1 answer

1

If it hasn’t changed since I used it some time ago, you can try with Intent and Bundle.

In class A:

Intent i = new Intent(ClasseA.this, ClasseB.class);

Bundle bundle = new Bundle();
bundle.putString("email", "[email protected]");

i.putExtras(bundle);
startActivity(i);
finish();

In class B:

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    email = getIntent().getExtras().getString("email");  
}
  • It is signaling the following error in Classeb "'onCreate(Bundle)' is already defined in 'Ep.gismed.gismed.Activity.Home'"

  • See if you’ve posted @Override or if you haven’t already declared onCreate.

  • What do I do if onCreate is already declared?

  • You put the command email = getIntent().getExt... in what you have already stated. It is just a suggestion, you can put it where you think it best.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.