How to exit the application completely from any screen

by elephantbug » Sat, 13 Sep 2008 15:55:38 GMT


Sponsored Links
 Hi,

Is there a way to exit the application completely at any place?

call finish() will only exit the current activity.

I tried to getApplication() from activity and call its onTerminate()
directly... but it seems not working at all...

Anyone can give any clue how to do it?

Thanks


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



How to exit the application completely from any screen

by Romain Guy » Sat, 13 Sep 2008 15:58:55 GMT


 There is no need to do this. The user can just press the Home key to
"exit" the app.






-- 
Romain Guy
www.curious-creature.org

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


Sponsored Links


How to exit the application completely from any screen

by plusminus » Sun, 14 Sep 2008 03:16:03 GMT


 otherwise, just grab a ""flag"" in onActivityResult(...) of the
"parent"-activity and call .finish() also.

Works really smooth with me.

Regards, plusminus
 http://anddev.org 
#  Worlds largest Android Development Community / Tutorials




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



How to exit the application completely from any screen

by Pau » Sun, 14 Sep 2008 03:46:00 GMT


 Hi,

if you kill the application completely:

int pid = android.os.Process.myPid();
android.os.Process.killProcess(pid);






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



How to exit the application completely from any screen

by elephantbug » Sun, 14 Sep 2008 03:46:00 GMT


 but our app wants to prevent user from continuing use the app. Maybe
freeze the app can also do the trick, which forces user to use home
dutton. There should be a way to auto exit , just do not know how.
Anyone?





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



How to exit the application completely from any screen

by Guillaume Perrot » Sun, 14 Sep 2008 17:18:54 GMT


 For my settings editor activity I use the following manifest flags:
allowTaskReparenting = true
finishOnTaskLaunch = true
and I save the settings at onPause()

These flags will finish the activity once it will brought to
background for any reason (HOME, BACK, another event...)





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



Other Threads

1. (Case 2338) [Contact us] Tmobile g1 android 1.6 robot

Hi Johan,
I am so grateful for your help.  I can't put into words how important this
is for me to get working.  I am making a  robot man!  Anyway here is the
logcat output of me starting bambuser, I then separate the output of when it
asked to force close which I then did:

I/ActivityManager(  107): Starting activity: Intent {
act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]
flg=0x10200000 cmp=com.bambuser.broadcaster/.BambuserStarter }
I/ActivityManager(  107): Start proc com.bambuser.broadcaster for activity
com.bambuser.broadcaster/.BambuserStarter: pid=333 uid=10039 gids={1006,
3003, 1015}
D/dalvikvm(  107): GC(1) freed 7676 objects / 372936 bytes in 194ms
I/WindowManager(  107): Setting rotation to 1, animFlags=0
I/WindowManager(  107): Config changed: { scale=1.0 imsi=0/0 loc=en_US
touch=3 keys=2/1/2 nav=3 orien=2 layout=18}
W/ActivityManager(  107): Failed setting process group of 199 to 1
W/System.err(  107): java.lang.SecurityException: No permission to modify
given thread
W/System.err(  107): at android.os.Process.setProcessGroup(Native Method)
W/System.err(  107): at
com.android.server.am.ActivityManagerService.updateOomAdjLocked(ActivityManagerService.java:12758)
W/System.err(  107): at
com.android.server.am.ActivityManagerService.updateOomAdjLocked(ActivityManagerService.java:12834)
W/System.err(  107): at
com.android.server.am.ActivityManagerService.removeContentProvider(ActivityManagerService.java:7514)
W/System.err(  107): at
android.app.ActivityThread.removeProviderLocked(ActivityThread.java:4032)
W/System.err(  107): at
android.app.ActivityThread.releaseProvider(ActivityThread.java:3997)
W/System.err(  107): at
android.app.ApplicationContext$ApplicationContentResolver.releaseProvider(ApplicationContext.java:1520)
W/System.err(  107): at
android.content.ContentResolver$CursorWrapperInner.finalize(ContentResolver.java:755)
W/System.err(  107): at dalvik.system.NativeStart.run(Native Method)
W/ActivityManager(  107): Failed setting process group of 166 to 1
W/System.err(  107): java.lang.SecurityException: No permission to modify
given thread
W/System.err(  107): at android.os.Process.setProcessGroup(Native Method)
W/System.err(  107): at
com.android.server.am.ActivityManagerService.updateOomAdjLocked(ActivityManagerService.java:12758)
W/System.err(  107): at
com.android.server.am.ActivityManagerService.updateOomAdjLocked(ActivityManagerService.java:12834)
W/System.err(  107): at
com.android.server.am.ActivityManagerService.removeContentProvider(ActivityManagerService.java:7514)
W/System.err(  107): at
android.app.ActivityThread.removeProviderLocked(ActivityThread.java:4032)
W/System.err(  107): at
android.app.ActivityThread.releaseProvider(ActivityThread.java:3997)
W/System.err(  107): at
android.app.ApplicationContext$ApplicationContentResolver.releaseProvider(ApplicationContext.java:1520)
W/System.err(  107): at
android.content.ContentResolver$CursorWrapperInner.finalize(ContentResolver.java:755)
W/System.err(  107): at dalvik.system.NativeStart.run(Native Method)
D/dalvikvm(  333): GC(2) freed 971 objects / 83312 bytes in 185ms
D/StatusBar(  107): updateResources
W/Resources(  333): Converting to string: TypedValue{t=0x10/d=0x1bb a=-1}
W/Resources(  333): Converting to string: TypedValue{t=0x10/d=0x1bb a=-1}
D/dalvikvm(  333): Trying to load lib
/data/data/com.bambuser.broadcaster/lib/libbambuser.so 0x438cf788
D/dalvikvm(  333): Added shared lib
/data/data/com.bambuser.broadcaster/lib/libbambuser.so 0x438cf788
D/dalvikvm(  333): No JNI_OnLoad found in
/data/data/com.bambuser.broadcaster/lib/libbambuser.so 0x438cf788
D/dalvikvm(  333): +++ not scanning '/system/lib/libwebcore.so' for 'init'
(wrong CL)
D/dalvikvm(  333): +++ not scanning '/system/lib/libexif.so' for 'init'
(wrong CL)
W/Resources(  333): Converting to string: TypedValue{t=0x10/d=0x1bb a=-1}
D/LocationManager(  333): Constructor: service =
android.location.ilocationmanager$stub$pr...@43921af0
D/dalvikvm(  333): +++ not scanning '/system/lib/libwebcore.so' for 'init'
(wrong CL)
D/dalvikvm(  333): +++ not scanning '/system/lib/libexif.so' for 'init'
(wrong CL)
W/InputManagerService(  107): Starting input on non-focused client
com.android.internal.view.iinputmethodclient$stub$pr...@438d0118 (uid=10039
pid=333)
W/InputManagerService(  107): Client not active, ignoring focus gain of:
com.android.internal.view.iinputmethodclient$stub$pr...@4388c350
D/dalvikvm(  333): Trying to load lib
/data/data/com.bambuser.broadcaster/lib/libcameramod-cupcake.so 0x438cf788
I/dalvikvm(  333): Unable to
dlopen(/data/data/com.bambuser.broadcaster/lib/libcameramod-cupcake.so):
Cannot load library: reloc_library[1172]:    88 cannot locate
'_ZN7android6Camera14setRawCallbackEPFvRKNS_2spINS_7IMemoryEEEPvES6_'...
D/dalvikvm(  333): Trying to load lib
/data/data/com.bambuser.broadcaster/lib/libcameramod-donut.so 0x438cf788
D/dalvikvm(  333): Added shared lib
/data/data/com.bambuser.broadcaster/lib/libcameramod-donut.so 0x438cf788
W/dalvikvm(  333): Warning: Landroid/hardware/Camera;.native_setup
(Ljava/lang/Object;)V was already registered/resolved?
W/dalvikvm(  333): Warning: Landroid/hardware/Camera;.native_release ()V was
already registered/resolved?
W/dalvikvm(  333): Warning: Landroid/hardware/Camera;.setPreviewDisplay
(Landroid/view/Surface;)V was already registered/resolved?
W/dalvikvm(  333): Warning: Landroid/hardware/Camera;.startPreview ()V was
already registered/resolved?
W/dalvikvm(  333): Warning: Landroid/hardware/Camera;.stopPreview ()V was
already registered/resolved?
W/dalvikvm(  333): Warning: Landroid/hardware/Camera;.previewEnabled ()Z was
already registered/resolved?
W/dalvikvm(  333): Warning: Landroid/hardware/Camera;.setHasPreviewCallback
(ZZ)V was already registered/resolved?
W/dalvikvm(  333): Warning: Landroid/hardware/Camera;.native_autoFocus ()V
was already registered/resolved?
W/dalvikvm(  333): Warning: Landroid/hardware/Camera;.native_takePicture ()V
was already registered/resolved?
W/dalvikvm(  333): Warning: Landroid/hardware/Camera;.native_setParameters
(Ljava/lang/String;)V was already registered/resolved?
W/dalvikvm(  333): Warning: Landroid/hardware/Camera;.native_getParameters
()Ljava/lang/String; was already registered/resolved?
W/dalvikvm(  333): Warning: Landroid/hardware/Camera;.reconnect ()V was
already registered/resolved?
W/dalvikvm(  333): Warning: Landroid/hardware/Camera;.lock ()I was already
registered/resolved?
W/dalvikvm(  333): Warning: Landroid/hardware/Camera;.unlock ()I was already
registered/resolved?
D/dalvikvm(  333): +++ not scanning '/system/lib/libwebcore.so' for 'init'
(wrong CL)
D/dalvikvm(  333): +++ not scanning '/system/lib/libexif.so' for 'init'
(wrong CL)
D/CameraService(   89): CameraService::connect E (pid 333, client 0x1fbc8)
D/CameraService(   89): Client::Client E (pid 333)
D/QualcommCameraHardware(   89): createInstance: E
W/SurfaceFlinger(  107): timeout expired mFreezeDisplay=1, mFreezeCount=0
W/WindowManager(  107): App freeze timeout expired.
W/WindowManager(  107): Force clearing freeze: AppWindowToken{4397ef28
token=HistoryRecord{4397df38 com.bambuser.broadcaster/.BambuserStarter}}
D/dalvikvm(  107): GC(1) freed 3395 objects / 189808 bytes in 149ms
W/ActivityManager(  107): Launch timeout has expired, giving up wake lock!
W/ActivityManager(  107): Activity idle timeout for HistoryRecord{4397df38
com.bambuser.broadcaster/.BambuserStarter}
I/wpa_supplicant(  144): CTRL-EVENT-SCAN-RESULTS  Ready
D/WifiService(  107): ACTION_BATTERY_CHANGED pluggedType: 2
D/Sensors (  107): sensors=00000000, real=00000000
D/AKMD    (   94): Compass CLOSE
D/dalvikvm(  107): GC(2) freed 1732 objects / 76456 bytes in 248ms
D/WifiService(  107): ACTION_SCREEN_OFF
D/SurfaceFlinger(  107): About to give-up screen, flinger = 0x18f020
I/wpa_supplicant(  144): CTRL-EVENT-STATE-CHANGE id=-1 state=8
V/WifiMonitor(  107): Event [CTRL-EVENT-STATE-CHANGE id=-1 state=8]
V/WifiStateTracker(  107): Changing supplicant state: SCANNING ==> DORMANT
D/WifiStateTracker(  107): Deconfiguring interface and stopping DHCP
W/ActivityManager(  107): Activity pause timeout for HistoryRecord{4397df38
com.bambuser.broadcaster/.BambuserStarter}
I/WindowManager(  107): Setting rotation to 0, animFlags=0
I/WindowManager(  107): Config changed: { scale=1.0 imsi=0/0 loc=en_US
touch=3 keys=2/1/2 nav=3 orien=1 layout=18}
I/WindowManager(  107): Config changed: { scale=1.0 imsi=0/0 loc=en_US
touch=3 keys=2/1/2 nav=3 orien=1 layout=18}
D/StatusBar(  107): updateResources
I/wpa_supplicant(  144): CTRL-EVENT-DRIVER-STATE STOPPED
V/WifiMonitor(  107): Event [CTRL-EVENT-DRIVER-STATE STOPPED]
W/WindowManager(  107): Window freeze timeout expired.
W/WindowManager(  107): Force clearing orientation change: Window{438c6f18
com.bambuser.broadcaster/com.bambuser.broadcaster.BambuserStarter
paused=false}
D/dalvikvm(  107): GC(1) freed 2908 objects / 137160 bytes in 231ms
D/dalvikvm(  166): GC(1) freed 771 objects / 32896 bytes in 153ms
D/dalvikvm(  199): GC(1) freed 5248 objects / 373024 bytes in 146ms




D/WifiService(  107): ACTION_BATTERY_CHANGED pluggedType: 2
D/KeyguardViewMediator(  107): wakeWhenReadyLocked(4)
D/KeyguardViewMediator(  107): handleWakeWhenReady(4)
D/KeyguardViewMediator(  107): pokeWakelock(5000)
D/AKMD    (   94): Compass OPEN
D/Sensors (  107): sensors=00000001, real=00000001
D/SurfaceFlinger(  107): Screen about to return, flinger = 0x18f020
D/WifiService(  107): ACTION_SCREEN_ON
I/wpa_supplicant(  144): CTRL-EVENT-DRIVER-STATE STARTED
V/WifiMonitor(  107): Event [CTRL-EVENT-DRIVER-STATE STARTED]
I/wpa_supplicant(  144): CTRL-EVENT-STATE-CHANGE id=-1 state=2
V/WifiMonitor(  107): Event [CTRL-EVENT-STATE-CHANGE id=-1 state=2]
V/WifiStateTracker(  107): Changing supplicant state: DORMANT ==> SCANNING
I/wpa_supplicant(  144): CTRL-EVENT-SCAN-RESULTS  Ready
I/WindowManager(  107): onOrientationChanged, rotation changed to 0
D/KeyguardViewMediator(  107): pokeWakelock(5000)
I/WindowManager(  107): Setting rotation to 1, animFlags=0
I/WindowManager(  107): Config changed: { scale=1.0 imsi=0/0 loc=en_US
touch=3 keys=2/1/2 nav=3 orien=2 layout=18}
I/WindowManager(  107): Config changed: { scale=1.0 imsi=0/0 loc=en_US
touch=3 keys=2/1/2 nav=3 orien=2 layout=18}
D/StatusBar(  107): updateResources
W/WindowManager(  107): Window freeze timeout expired.
W/WindowManager(  107): Force clearing orientation change: Window{438c6f18
com.bambuser.broadcaster/com.bambuser.broadcaster.BambuserStarter
paused=false}
D/dalvikvm(  107): GC(1) freed 4220 objects / 207808 bytes in 180ms
W/WindowManager(  107): Key dispatching timed out sending to
Panel:com.bambuser.broadcaster/com.bambuser.broadcaster.BambuserStarter
W/WindowManager(  107): Dispatch state: {{KeyEvent{action=1 code=82 repeat=0
meta=0 scancode=139 mFlags=8} to Window{43943cd8
Panel:com.bambuser.broadcaster/com.bambuser.broadcaster.BambuserStarter
paused=false} @ 1255809949722 lw=Window{43943cd8
Panel:com.bambuser.broadcaster/com.bambuser.broadcaster.BambuserStarter
paused=false} lb=android.os.binderpr...@4388bb08 fin=false gfw=true ed=true
tts=0 wf=false fp=false mcf=Window{43943cd8
Panel:com.bambuser.broadcaster/com.bambuser.broadcaster.BambuserStarter
paused=false}}}
W/WindowManager(  107): Current state:  {{null to Window{43943cd8
Panel:com.bambuser.broadcaster/com.bambuser.broadcaster.BambuserStarter
paused=false} @ 1255809954736 lw=Window{43943cd8
Panel:com.bambuser.broadcaster/com.bambuser.broadcaster.BambuserStarter
paused=false} lb=android.os.binderpr...@4388bb08 fin=false gfw=true ed=true
tts=0 wf=false fp=false mcf=Window{43943cd8
Panel:com.bambuser.broadcaster/com.bambuser.broadcaster.BambuserStarter
paused=false}}}
I/ActivityManager(  107): ANR in process: com.bambuser.broadcaster (last in
com.bambuser.broadcaster)
I/ActivityManager(  107): Annotation: keyDispatchingTimedOut
I/ActivityManager(  107): CPU usage:
I/ActivityManager(  107): Load: 0.0 / 0.0 / 0.0
I/ActivityManager(  107): CPU usage from 10856ms to 47ms ago:
I/ActivityManager(  107):   system_server: 25% = 24% user + 0% kernel /
faults: 1064 minor 3 major
I/ActivityManager(  107):   akmd: 0% = 0% user + 0% kernel / faults: 26
minor
I/ActivityManager(  107):   adbd: 0% = 0% user + 0% kernel
I/ActivityManager(  107):   suspend: 0% = 0% user + 0% kernel
I/ActivityManager(  107):   wpa_supplicant: 0% = 0% user + 0% kernel /
faults: 6 minor 1 major
I/ActivityManager(  107):   com.android.phone: 0% = 0% user + 0% kernel /
faults: 97 minor 2 major
I/ActivityManager(  107):   android.process.media: 0% = 0% user + 0% kernel
/ faults: 253 minor
I/ActivityManager(  107):   com.google.process.gapps: 0% = 0% user + 0%
kernel
I/ActivityManager(  107):   com.google.android.apps.maps:FriendService: 0% =
0% user + 0% kernel / faults: 309 minor
I/ActivityManager(  107):   com.android.inputmethod.latin: 0% = 0% user + 0%
kernel / faults: 7 minor
I/ActivityManager(  107): TOTAL: 30% = 29% user + 0% kernel
I/ActivityManager(  107): Removing old ANR trace file from
/data/anr/traces.txt
I/Process (  107): Sending signal. PID: 333 SIG: 3
I/dalvikvm(  333): threadid=7: reacting to signal 3
I/Process (  107): Sending signal. PID: 107 SIG: 3
I/dalvikvm(  107): threadid=7: reacting to signal 3
I/dalvikvm(  333): Wrote stack trace to '/data/anr/traces.txt'
I/dalvikvm(  107): Wrote stack trace to '/data/anr/traces.txt'
W/ActivityManager(  107): Activity idle timeout for HistoryRecord{4397df38
com.bambuser.broadcaster/.BambuserStarter}
I/Process (  107): Sending signal. PID: 327 SIG: 3
I/dalvikvm(  327): threadid=7: reacting to signal 3
I/dalvikvm(  327): Wrote stack trace to '/data/anr/traces.txt'
I/Process (  107): Sending signal. PID: 319 SIG: 3
I/dalvikvm(  319): threadid=7: reacting to signal 3
I/dalvikvm(  319): Wrote stack trace to '/data/anr/traces.txt'
I/Process (  107): Sending signal. PID: 250 SIG: 3
I/dalvikvm(  250): threadid=7: reacting to signal 3
I/dalvikvm(  250): Wrote stack trace to '/data/anr/traces.txt'
I/Process (  107): Sending signal. PID: 178 SIG: 3
I/dalvikvm(  178): threadid=7: reacting to signal 3
I/dalvikvm(  178): Wrote stack trace to '/data/anr/traces.txt'
I/Process (  107): Sending signal. PID: 199 SIG: 3
I/dalvikvm(  199): threadid=7: reacting to signal 3
I/dalvikvm(  199): Wrote stack trace to '/data/anr/traces.txt'
I/Process (  107): Sending signal. PID: 237 SIG: 3
I/dalvikvm(  237): threadid=7: reacting to signal 3
I/dalvikvm(  237): Wrote stack trace to '/data/anr/traces.txt'
I/Process (  107): Sending signal. PID: 305 SIG: 3
I/dalvikvm(  305): threadid=7: reacting to signal 3
I/dalvikvm(  305): Wrote stack trace to '/data/anr/traces.txt'
I/Process (  107): Sending signal. PID: 291 SIG: 3
I/dalvikvm(  291): threadid=7: reacting to signal 3
I/dalvikvm(  291): Wrote stack trace to '/data/anr/traces.txt'
I/Process (  107): Sending signal. PID: 281 SIG: 3
I/dalvikvm(  281): threadid=7: reacting to signal 3
I/dalvikvm(  281): Wrote stack trace to '/data/anr/traces.txt'
I/Process (  107): Sending signal. PID: 268 SIG: 3
I/dalvikvm(  268): threadid=7: reacting to signal 3
I/dalvikvm(  268): Wrote stack trace to '/data/anr/traces.txt'
I/Process (  107): Sending signal. PID: 262 SIG: 3
I/dalvikvm(  262): threadid=7: reacting to signal 3
I/dalvikvm(  262): Wrote stack trace to '/data/anr/traces.txt'
I/Process (  107): Sending signal. PID: 212 SIG: 3
I/dalvikvm(  212): threadid=7: reacting to signal 3
I/dalvikvm(  212): Wrote stack trace to '/data/anr/traces.txt'
I/Process (  107): Sending signal. PID: 162 SIG: 3
I/dalvikvm(  162): threadid=7: reacting to signal 3
I/dalvikvm(  162): Wrote stack trace to '/data/anr/traces.txt'
I/Process (  107): Sending signal. PID: 166 SIG: 3
I/dalvikvm(  166): threadid=7: reacting to signal 3
I/dalvikvm(  166): Wrote stack trace to '/data/anr/traces.txt'
I/ActivityManager(  107): Start proc com.android.bugreport for broadcast
com.android.bugreport/.BugReportReceiver: pid=8109 uid=10002 gids={1007,
1015}
I/ARMAssembler(  107): generated
scanline__00000077:03515104_00001001_00000000 [ 64 ipp] (84 ins) at
[0x1fbeb0:0x1fc000] in 946045 ns
I/WindowManager(  107): onOrientationChanged, rotation changed to 1
I/ActivityManager(  107): Killing process com.bambuser.broadcaster (pid=333)
at user's request
I/Process (  107): Sending signal. PID: 333 SIG: 9
I/ActivityManager(  107): Process com.bambuser.broadcaster (pid 333) has
died.
I/WindowManager(  107): WIN DEATH: Window{438c6f18
com.bambuser.broadcaster/com.bambuser.broadcaster.BambuserStarter
paused=false}
I/WindowManager(  107): WIN DEATH: Window{43943cd8
Panel:com.bambuser.broadcaster/com.bambuser.broadcaster.BambuserStarter
paused=false}
I/WindowManager(  107): WIN DEATH: Window{43982ea8 SurfaceView paused=false}
D/HomeLoaders(  166): aborting loaders
D/HomeLoaders(  166): load applications
D/HomeLoaders(  166):   --> applications loaded, return
D/HomeLoaders(  166): loading user items
D/HomeLoaders(  166):   --> items loaded, return
D/Launcher(  166): ------> binding 7 items
D/Launcher(  166): ------> binding 0 widgets
D/Launcher(  166): ------> start binding items

Please let me know anything I can try to fix this.  Bambuser works on the
non-serial api boot image.  If you want to do this boot image yourself
simply do this:

wget 
boot_2.6.29.6-cm42.img.tar.gz<http://android-serialport-api.googlecode.com/files/boot_2.6.29.6-cm42.img.tar.gz>
get your phone in fastboot mode
fastboot-mac boot boot_2.6.29.6-cm42.img

Then simply try to start bambuser.  I can't emphasize enough how amazing
this would be for bambuser, the first robot with android, your company will
get excellent press.  Help me please! :>

-Tim

P.S.

I am petitioning ustream and qik for help as well.  I will use whomever
helps me to get this working first :>





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

2. Make "VideoView" into Center?

All,

Does anyone know how to make "VideoView" into center of the device? Is there 
any chance to do that programmatic ally (or) any other way? I am playing a 
video file on VideoView. It is showing the video on a bit top postion, instead 
of as usual in center of the device. When i play the same video from device, it 
is playing from center of the device. May i get some one's help on this?

Appreciate your help on this.



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

3. SDCard explore on the device?

4. kml in listview

5. Why do I need requery() when I already have notifyDataSetChanged()

6. How to disable screen orientation change in code?

7. Location.getLastKnownLocation returns null