passing data between two actvities.

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

passing data between two actvities.

Postby poch » Mon Nov 30, 2009 6:10 am

Here is my Problem :

I want to pass multi dimensional String array between two activities or pages.

I already tried with bundle.putextra like methods. But those allow only one dimensional string array.

I really hope you can help me on this with example java code . Here is my String array, final String[][] names={{"1","pavan"},{"2","kumar"},{"3","kora"}};

Please do reply.Its very urgent for my project .


Thank you!
poch
Junior Developer
Junior Developer
 
Posts: 11
Joined: Sun Nov 29, 2009 5:55 pm
Location: INDIA

Top

Postby padde » Mon Nov 30, 2009 6:56 am

This works for me:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.         Intent i = new Intent();
  3.  
  4.         String[][] names={{"1","pavan"},{"2","kumar"},{"3","kora"}};
  5.  
  6.         i.putExtra("array", names);
  7.  
  8.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


It is stored as serializable. I guess you will have to cast it back to String[][]
to get it back out of the bundle.
padde
Master Developer
Master Developer
 
Posts: 443
Joined: Wed Apr 08, 2009 4:52 pm

passing data between two actvities.

Postby poch » Mon Nov 30, 2009 1:10 pm

Thanks. But still i got problem with reading that two dimensional string array object .Could you please give me a code example for reading and displaying two dimensional array elements. I hope you do reply.
poch
Junior Developer
Junior Developer
 
Posts: 11
Joined: Sun Nov 29, 2009 5:55 pm
Location: INDIA

Postby poch » Tue Dec 01, 2009 4:57 am

Thank you so much i got it.
poch
Junior Developer
Junior Developer
 
Posts: 11
Joined: Sun Nov 29, 2009 5:55 pm
Location: INDIA

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 5 guests