I need to pass an array of String/integer values from one Activity to another. How do I achieve this?
At the sender side, the code should be:
String[] myStrings=new String[2];
myStrings[0]="MONDAY";
myStrings[1]="TUESDAY";
Intent intent = new Intent(v.getContext(), Animation_program.class);
Bundle bundle = new Bundle();
intent.putExtra("strings", myStrings);
intent.putExtras(bundle);
startActivity(intent);
At the reciever side, the code should be:
Intent i = getIntent();
Bundle extras=i.getExtras();
if(extras != null) //this line is necessary for getting any value
{
String[] fajr_Values = i.getStringArrayExtra("strings");
Toast.makeText(this, "value="+fajr_Values[0]+""+fajr_Values[1], Toast.LENGTH_SHORT).show();
}