switch (mode) {
case "finish":
finish();
break;
case "finish_remove":
finishAndRemoveTask();
break;
case "move_task_back":
moveTaskToBack(true);
break;
case "system_exit":
System.exit(0);
break;
case "kill_process":
Process.killProcess(Process.myPid());
break;
}
Since: API Level 1
Move the task containing this activity to the back of the activity stack.
The activity’s order within the task is unchanged.
If the task was moved (or it was already at the back) true is returned, else false.
パラメータ
nonRoot If false then this only works if the activity is the root of a task; if true it will work for any activity in a task.
訳:falseの場合は現在のアクティビティがタスクのルートアクティビティ(アプリケーションの開始アクティビティ)の時だけ動作します。
trueの場合はタスク内のどのアクティビティであっても動作します。
Since: API Level 1
Kill the process with the given PID.
Note that, though this API allows us to request to kill any process based on its PID,
the kernel will still impose standard restrictions on which PIDs you are actually able to kill.
Typically this means only the process running the caller’s packages/application and any additional
processes created by that app; packages sharing a common UID will also be able to kill each other’s processes.
訳:指定したIDのプロセスを終了します。
このAPIでは指定のPIDに基づいてどんなプロセスでも終了することが許されていますが、
実際終了できるかどうかはカーネルの標準的な制限で決まる点に注意してください。
つまり、典型的には呼び出し元のパッケージやアプリケーションが実行しているプロセスと、そのアプリが作成した追加のプロセスに限られるという意味です。
UIDを共有しているパッケージもまたお互いのプロセスを終了させる事ができます。
Since: API Level 1
Causes the virtual machine to stop running and the program to exit.
If runFinalizersOnExit(boolean) has been previously invoked with a true argument, then all objects will be properly garbage-collected and finalized first.
訳:バーチャルマシンの実行を停止し、プログラムを終了させます。
runFinalizersOnExit(boolean) を事前に引数にtrueを指定して呼び出してれば、全てのオブジェクトは最初に適切にガベージコレクトされてファイナライズされます。
E/AndroidRuntime(10100): Uncaught handler: thread main exiting due to uncaught exception<br />
E/AndroidRuntime(10100): java.lang.RuntimeException: mBaselineAlignedChildIndex of LinearLayout set to an index that is out of bounds.<br />
E/AndroidRuntime(10100): at android.widget.LinearLayout.getBaseline(LinearLayout.java:151)<br />
E/AndroidRuntime(10100): at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:644)<br />
E/AndroidRuntime(10100): at android.widget.LinearLayout.onMeasure(LinearLayout.java:280)<br />
E/AndroidRuntime(10100): at android.view.View.measure(View.java:7755)<br />
E/AndroidRuntime(10100): at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:892)<br />
E/AndroidRuntime(10100): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)<br />
E/AndroidRuntime(10100): at android.widget.ScrollView.onMeasure(ScrollView.java:276)<br />
E/AndroidRuntime(10100): at android.view.View.measure(View.java:7755)<br />
E/AndroidRuntime(10100): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2989)<br />
E/AndroidRuntime(10100): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)<br />
E/AndroidRuntime(10100): at android.view.View.measure(View.java:7755)<br />
E/AndroidRuntime(10100): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2989)<br />
E/AndroidRuntime(10100): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)<br />
E/AndroidRuntime(10100): at android.view.View.measure(View.java:7755)<br />
E/AndroidRuntime(10100): at android.widget.LinearLayout.measureVertical(LinearLayout.java:464)<br />
E/AndroidRuntime(10100): at android.widget.LinearLayout.onMeasure(LinearLayout.java:278)<br />
E/AndroidRuntime(10100): at android.view.View.measure(View.java:7755)<br />
E/AndroidRuntime(10100): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2989)<br />
E/AndroidRuntime(10100): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)<br />
E/AndroidRuntime(10100): at android.view.View.measure(View.java:7755)<br />
E/AndroidRuntime(10100): at android.view.ViewRoot.performTraversals(ViewRoot.java:748)<br />
E/AndroidRuntime(10100): at android.view.ViewRoot.handleMessage(ViewRoot.java:1614)<br />
E/AndroidRuntime(10100): at android.os.Handler.dispatchMessage(Handler.java:99)<br />
E/AndroidRuntime(10100): at android.os.Looper.loop(Looper.java:123)<br />
E/AndroidRuntime(10100): at android.app.ActivityThread.main(ActivityThread.java:4203)<br />
E/AndroidRuntime(10100): at java.lang.reflect.Method.invokeNative(Native Method)<br />
E/AndroidRuntime(10100): at java.lang.reflect.Method.invoke(Method.java:521)<br />
E/AndroidRuntime(10100): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:799)<br />
E/AndroidRuntime(10100): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)<br />
E/AndroidRuntime(10100): at dalvik.system.NativeStart.main(Native Method)<br />