Receiving Data of nested Subactivities

Put your problem here if it does not fit any of the other categories.

Receiving Data of nested Subactivities

Postby bavarol » Fri May 30, 2008 1:19 pm

Hi I know, what I should do when I pass data between activities but I don't know very well how I should do if I would want to develop the next:

Activity 1
______________________________bundle(=data2+data3)
__v_________________________________^
Activity 2
_data2________________________bundle(=data2+data3)
__v_________________________________^
Activity 3
I Show data2 and I get data 3 => bundle(=data2+data3)


I can get bundle(=data2+data3) in the onActivityResult(...) of the Activity 2, but how could I send back this information to Activity 1?

Thx
bavarol
Experienced Developer
Experienced Developer
 
Posts: 52
Joined: Mon Dec 10, 2007 9:19 pm

Top

Postby chris » Fri Jun 06, 2008 3:24 pm

Hi

you could broadcast intent in activity 2 and 3 with data attached in a bundle and receive them with an intentreceiver in activity 1.

if you find a more elegant way , please , let me know.

Regards

Chris
chris
Junior Developer
Junior Developer
 
Posts: 18
Joined: Sat Feb 02, 2008 4:39 pm

Postby bavarol » Sun Jul 27, 2008 9:29 pm

chris wrote:Hi

you could broadcast intent in activity 2 and 3 with data attached in a bundle and receive them with an intentreceiver in activity 1.

if you find a more elegant way , please , let me know.

Regards

Chris

Hi Chris,
please forgive me but I solved this problem 6 weeks ago and I didn't realize, you have replied.

I passed data1 from Activity 1 to Activity2 and from Activity2 data1 and data2(specific data of Activity2) to Activity3, then I put on an "extras" bundle: data1, data2 and data3(specific data of Activity3) together on the Activity3 and I sent back to Activity 2 by setResult(RESULT_OK,null,extras), and sent back to Activity1 like this:

On Activity2
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.     protected void onActivityResult(int requestCode, int resultCode,
  2.                         String data, Bundle extras){                                                           
  3.                                
  4.                                 if(requestCode == REQ_CODE){
  5.                                        
  6.                                         if(resultCode == RESULT_OK){
  7.                                                
  8.                                                 Activity2.this.setResult(RESULT_OK,null,extras);
  9.                                                
  10.                                                 Activity2.this.finish();
  11.                                                
  12.                                         }
  13.                                        
  14.                                 }
  15.                                
  16.                        
  17.         }
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


On Activity1 you can get the data as usually, also, extras.getXXX(...).

I hope, you could understand all.

Regards
bavarol
Experienced Developer
Experienced Developer
 
Posts: 52
Joined: Mon Dec 10, 2007 9:19 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 28 guests