The closest to support "minimizing" an application is to use a
combination of controller activity and (local) service which executes
the background behavior of the application. While running, the service
can post a persistent notification into the status bar which can be
used to re-start the controller activity. Whenever the activity
launches, it tries to bind to the service and start it if it is not
already running. An explicit stop command (e.g. menu option) from the
controller activity stops the service and effectively the application.
Home or back buttons or anything which launches another activity,
serves to "minimize" the app into the background.

For example the audio player seems to use this usage pattern and I was
trying to copy that for NetMeter:

http://code.google.com/p/android-labs/source/browse/trunk/NetMeter/src/com/google/android/netmeter/NetMeter.java
http://code.google.com/p/android-labs/source/browse/trunk/NetMeter/src/com/google/android/netmeter/NetMeterService.java

The activity/service interactions are largely based on the tutorial
already posted in this thread and the local-service example from the
API samples (http://developer.android.com/guide/samples/ApiDemos/src/
com/example/android/apis/app/LocalServiceBinding.html).

Bernhard

On Feb 13, 2:03 pm, themakos <[email protected]> wrote:
> Hello. i need to make an application that runs a thread on the
> background of andorid (it will be used as a worker thread in a
> distributed system).
> What i actualy want to do is make a little app that has a start,stop
> and hide button.
> the start button will start the worker thread and the stop button will
> stop it. The hide button will put the window in the background
> (showing the main menu,something like minimising a window in a pc) so
> that the app's thread will continue running in the background in case
> a client sends data to be processed. The thread will stop By selecting
> and executing the app again from the main menu and pressing the stop
> button.
>
> What i actually need is a demo of a "hide"-"minimize" function for my
> app.
>
> thanks in advance!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to