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. Can we change the status Bar's background?

Hi All,

We can add some icons in the status Bar but I can not find the way to
modify the status Bar's background. E.G. I want to use one image to
replace its current white background.

Can anyone provide some advices? Thanks a lot.

B. R.

Ji
--~--~---------~--~----~------------~-------~--~----~

2. Does Android Dev phone use Atheros for its wifi?

Thanks for the quick reply!

Is there a driver for the TI 1251, such that we can configure it on command
prompt?

Thanks







--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-kernel+unsubscr...@googlegroups.com
website: 

3. WiMAX for Android

4. Does Android Dev phone use Atheros for its wifi?

5. Interfacing to a PIC Microcontroller

6. Nice article

7. Reverse Geocoding Example / Source Code