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. Keeping MediaController from timing out after a certain amount of time

VideoView itself will hide/show the MediaController as it sees fit, so
your call to show() will only be in effect until VideoView decides to
hide (or show with a timeout) it again.
Also, you are calling MediaController.show() before the
MediaController is even attached to the VideoView.





--~--~---------~--~----~------------~-------~--~----~

2. i want to trace android kernel

hi all,
I want to trace the source code of the android system from the
begining of runing it till the emulator appear
and also want to know the main function (which I think on the kernel )
that print the strings we saw on the emulator screen

waiting for any help
thanks
--~--~---------~--~----~------------~-------~--~----~

3. Keeping MediaController from timing out after a certain amount of time

4. Should we still force our apps to API level 2?

5. Accessing assets that are larger than 1M?

6. Any API to get the time elapsed since the system was started?

7. onCreateContextMenu() not called in Notepad tutorial