Storing in ArrayList then sending via intent to be stored in ListView

+1 Muhammad Faisal Hyder · August 17, 2014
Hi , to all , thank god i found this  forum , after posting on Stackoverflow and for asking help on diff. sites none helped...!

Task: When i click button it saves in Array-List (coz I have to populate a list in receiving Activity , but not open 2nd activity yet.) then send to another activity receives in Array-List then set this coming Array-List in a ListView.
Finally when i click the "History" button it opens activity and show me the list..!
thanks in advance , really need help in this.!

Sending Code from class Main:-

if (TextUtils.isEmpty(etDisp.getText().toString())) {

            ArrayList<String> sendinglist = new ArrayList<String>();
           String storage = etDisp.getText().toString();

            Intent i = new Intent(Main.this, History.class);
            i.putStringArrayListExtra("value", (ArrayList<String>) sendinglist);
            // startActivity(i); because i want to start activity on click of another button.!


Receiving Code in class History:-

public class History extends Activity implements View.OnClickListener {

Button Back;
ListView lv;

public void onCreate(Bundle savedInstanceState) {

Back = (Button) findViewById(;
lv = (ListView) findViewById(;
Bundle b = getIntent().getExtras();
if (b != null) {
ArrayList<String> receivinglist = (ArrayList<String>) b.getStringArrayList("value");
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
} else {
Toast.makeText(this, "NO data Found", Toast.LENGTH_SHORT).show();

Post a Reply


Oldest  Newest  Rating
0 Muhammad Faisal Hyder · August 19, 2014
I have finally solved this Problem.! If any one needs help relating this topic kindly leave a message.
0 Muhammad Faisal Hyder · August 17, 2014
I have achieved it half way...!
I click Equals-to and it stores in Shared Preferences and when i click History button it simply opens activity with my Calculation.! Hurray...! but........ :(  i need ARRAY to save my inputs which Shared Preferences support but with complexity.! now conquering this thing......! 
0 Çağlan Turgut · August 17, 2014
The community in Bucky's Room is not so big so you will have to wait till someone who knows the answer sees the topic.Sorry,  I suggest you to wait until tomorrow. I don't really know much about the topic so I can't help :(.But I'm sure someone will if you wait long enough.
0 Muhammad Faisal Hyder · August 17, 2014
NO one here...........? any one who knows this ....!
0 Muhammad Faisal Hyder · August 17, 2014
Anybody plz....?
  • 1

Java / Android Development


Very popular language used to create desktop applications, website applets, and Android apps.

Bucky Roberts Administrator