Please come up with a more descriptive title next time. -Nick
On Apr 16, 1:55 am, Shoby Sunny <[email protected]> wrote: > let X and Y be the 2 activities, and X wants to send some txt to Y... > > the snippet of X should be like this: > > Code: > > private void sendTxt() > { > Intent intent = new Intent();//intent is like the envelop > intent.setClass(X.this, Y.class);//arg1 is the current class and arg2 > is the class u wanna call > Bundle bundle = new Bundle(); //bundle is like the letter > bundle.putString ("keyword", "hello") //arg1 is the keyword of the > txt, arg2 is the txt > intent.putExtras(bundle);//actually it's bundle who carries the > content u wanna pass > startActivity(intent); > > } > > accordingly, Y is: > > Code: > private void getTxt() > { > if (Y.this.getIntent().getExtras() != null) > { > Bundle bundle = this.getIntent().getExtras();//get the intent & bundle > passed by X > Toast.makeText(Y.this,bundle.getString("keyword"),Toast.LENGTH_SHORT).show( > );/*show > the txt in a Toast, and of course u can show it anywhere else u want > by calling Bundle.getString (String key) */ > > > > > > } > } > On Thu, Apr 15, 2010 at 11:18 AM, Ali Murtaza <[email protected]> wrote: > > > Hi > > > I am new in android and just want to save a data in one activity and then > > send it on other activity, just like notepad tutorials i used > > > Intent ii = > > > new Intent(Calendar.this, EditEvent.class); > > > ii.putExtra( > > > "eventdate", this.toString()); > > > and then in other activity > > > date > > > = savedInstanceState != null ? > > savedInstanceState.getString("eventdate"):null; > > > i used this but it is not working, the date contain null > > > please tell me error as well as the function which is run by default when > > activity context switching occurs. > > > Thanks > > > -- > > Ali Murtaza > > > BCSF06M021 > > Research Assistant > > Data Virtulization Ware House > > PUCIT, Lahore, Pakistan > > [email protected] > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to [email protected] > > To unsubscribe from this group, send email to > > [email protected] > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group > athttp://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

