Passing parameters from one Activity to another

1

I need to pass the name of a selected product on ListView to be displayed on a EditText .

I am currently on the screen that the user informs the customer and then opens the screen of new request, on this screen I have a button to select a product of this ListView .

Problem: When I enter the Activity from the list and select the product, it start on a new request screen restarting the customer information and showing only the name of the product in EditText .

How do I avoid the new load update only EditText ?

    
asked by anonymous 09.04.2014 / 20:14

2 answers

5

Good afternoon, maybe I was a bit confused by its description, but I will try to answer as I understood, to pass the information from one activity to another just reuse the bundle and go from activity to activity.

example:

//código para obter o bundle da activity anterior
Bundle bundle = getIntent.getExtras();

//obter alguma informação do bundle
String nome = bundle.getString("nome");

//adiciona alguma informação no bundle
bundle.putInt("idCliente", idCliente);
bundle.putFloat("valorProduto", valorProduto);

//passa o bundle para a próxima activity
startActivity(suaIntent.putExtras(bundle));

As for starting a new screen try using the startActivityForResult method instead of just startActivity to start the list. This returns a result for the previous activity. Here has a tutorial on how to return a result of an activity.

    
09.04.2014 / 20:48
1

When you call the finish(); method, Android removes the activity from the stack and can not return to it. If not, post the classes for further understanding.

    
11.04.2014 / 05:23