android studio pass value to another activity

Solutions on MaxInterview for android studio pass value to another activity by the best coders in the world

showing results for - "android studio pass value to another activity"
Alison
08 Apr 2016
1Intent i = new Intent(this, ActivityTwo.class);
2AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.autocomplete);
3String getrec=textView.getText().toString();
4
5//Create the bundle
6Bundle bundle = new Bundle();
7
8//Add your data to bundle
9bundle.putString(“stuff”, getrec);
10
11//Add the bundle to the intent
12i.putExtras(bundle);
13
14//Fire that second activity
15startActivity(i);
16
Tino
31 Jun 2018
1//Get the bundle
2Bundle bundle = getIntent().getExtras();
3
4//Extract the data…
5String stuff = bundle.getString(“stuff”); 
6