• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps pass value from first activity to third activity

krishnaveni

Well-Known Member
hi i wish to pass the value from first activity to third activity.. my first activity is CustomizedListview
the second activity is: SingleMenuItemActivity
the third activity is:InsertionExample
Here i have to pass the orderid value from CustomisedListView(first)activity to InsertionExampl(third)activity...how can i pass this...i have to passed orderid value from 1st activity to second activity..but i can;t develop firstactivity to third activity..please help me...how can i develop this..
 
The only time you can "pass" a value to an activity, is when the target activity is started. Another option would be to make the value in the first class static and then access it directly from the third activity.
 
ya i got the solution for this...
in my second activity have to wrote the below query:
public void onClick(View v) {
String s= getIntent().getStringExtra("orderid");
Intent i = new Intent(getApplicationContext(), InsertionExample.class);
i.putExtra(KEY_NAME, s);
startActivity(i);
}
});
in my third activity have to wrote below query:
Intent in = getIntent();

// Get XML values from previous intent
String orderid = in.getStringExtra(KEY_NAME);

// Displaying all values on the screen
TextView lblName = (TextView) findViewById(R.id.textView1);


lblName.setText(orderid);
Thanks.
 
Back
Top Bottom