Finish activity

by ReyLith » Sun, 04 Apr 2010 19:44:09 GMT


Sponsored Links
 Hi!

I have a problem with my application. During the execution of it, I
have some buttons which execute other activities when I click on them.
The way I am realising it is:

private OnClickListener scaleImage = new OnClickListener()
{
       public void onClick(View v)
       {
           Intent intent = new Intent();
           intent.setClass(main.this, Scale.class);
           startActivity(intent);

           update();
       }
};

The other activity finish it execution using the function finish(). I
have a problem. When the activity finish, the function update() should
be executed. However it doesn't run until I click on other button. I
don't know the reason, the function update() is just bellow of
startActivity.

Thank you very much. Regards.

--



Finish activity

by Mark Murphy » Sun, 04 Apr 2010 19:46:55 GMT


 


startActivity() is not a blocking call. As your code is written above,
your call to update() happens immediately after you call startActivity().

You may wish to use startActivityForResult(), so you can be notified via
onActivityResult() when then other activity has finish()-ed, and you can
call update() then. Or, depending on what update() does, you might
consider just putting that call in onStart() or onResume(), so you
"update" every time your activity comes back to the foreground.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

Android Consulting:  http://commonsware.com/consulting 

--


Sponsored Links


Other Threads

1. No View key event called back when BACK key is pressed while IME is shown?

Did you solve this?
Anyone knows solution to this problem?




-- 

2. Wtt im2 125rbu/bln sama xl unlimited 100rbu/bln

As per subject mau barter im2 broombastis 2, yang paket 125k/bln fu
2.5gb,saat ini paket unlimited masih ada sampe 10apr10,masih lengkap sma
dusnya...
Mau dituker sma paket unlimited xl yg 100k,karena d rumah saat ini signal
im2 agak kurang bagus...
Pengennya c tuker guling aja,tapi kalo dirasa saya harus nambah..infoin aja
harus nambah berapa..
Penawaran bisa dijapri ke adrians.ri...@gmail.com.posisi saya di jakarta.

Tks

-- 
"Indonesian Android Community [id-android]" 

3. Last Reminder - Order Android Vader

4. Setelah rooting N1

5. No mail

6. Using GPS in a thread

7. phone-as-client Socket connections time out in 3GS mode, but work fine in wifi