hii,
i am trying to pass key/values from Trial.java to CommonActivity.java.but i am getting error message as
rocess stop unexpectedly.i have two activities.Trial.java and CommonActivity.java.
getextra.can anybody please example the scenario of using getExtra vs
getExtras!so that i can decide to use better one in my application
i am trying to pass key/values from Trial.java to CommonActivity.java.but i am getting error message as

and in CommonActivity.class i am trying something like this:public void onClick(View v)
{
switch (v.getId())
{
case R.id.btnSequence:
Intent intent1 = new Intent();
intent1.setClass(this,CommonActivity.class);
Bundle bun1 = new Bundle();
bun1 .putString("String_key", "value1");
intent1.putExtras(bun1 );
startActivity(intent1);
break;
case R.id.btnVideo:
Intent intent2 = new Intent();
intent2.setClass(this,CommonActivity.class);
Bundle bun2 = new Bundle();
bun2 .putString("String_key", "value2");
intent2.putExtras(bun2);
startActivity(intent2);
break;
case R.id.btnInfo:
Intent intent3 = new Intent();
intent3.setClass(this,CommonActivity.class);
Bundle bun3 = new Bundle();
bun3 .putString("String_key", "value3");
intent2.putExtras(bun3);
startActivity(intent2);
break;
}
also while searching on net i got confused with getExtras andpublic void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
Bundle bun = new Bundle();//guessing i am wrong here where are //bun1,bun2 and bun3
Intent getIntent = new Intent();
bun = getIntent.getExtras();
String param = bun.getString("String_key");
if(param.equals("value1"))
{
setContentView(R.layout.main1);
//ImageView image = (ImageView) findViewById(R.id.test_image);
}
if (param.equals("value2"))
{
setContentView(R.layout.main2);
}
if (param.equals("value3"))
{
setContentView(R.layout.main3);
}
}
getextra.can anybody please example the scenario of using getExtra vs
getExtras!so that i can decide to use better one in my application