1 /*
2  * Copyright (C) 2006 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.app.activity;
18 
19 import android.app.Activity;
20 import android.os.Handler;
21 import android.os.Looper;
22 import android.os.Message;
23 import android.os.MessageQueue;
24 import android.os.Bundle;
25 
26 public class TestedActivity extends Activity
27 {
TestedActivity()28     public TestedActivity()
29     {
30     }
31 
onCreate(Bundle icicle)32     public void onCreate(Bundle icicle)
33     {
34         super.onCreate(icicle);
35     }
36 
onRestoreInstanceState(Bundle state)37     protected void onRestoreInstanceState(Bundle state)
38     {
39         super.onRestoreInstanceState(state);
40     }
41 
onResume()42     protected void onResume()
43     {
44         super.onResume();
45         Looper.myLooper().myQueue().addIdleHandler(new Idler());
46     }
47 
onSaveInstanceState(Bundle outState)48     protected void onSaveInstanceState(Bundle outState)
49     {
50         super.onSaveInstanceState(outState);
51     }
52 
onStop()53     protected void onStop()
54     {
55         super.onStop();
56     }
57 
58     private Handler mHandler = new Handler() {
59         public void handleMessage(Message msg) {
60             setResult(RESULT_OK);
61             finish();
62         }
63     };
64 
65     private class Idler implements MessageQueue.IdleHandler
66     {
queueIdle()67         public final boolean queueIdle()
68         {
69             //Message m = Message.obtain();
70             //mHandler.sendMessageAtTime(m, SystemClock.uptimeMillis()+1000);
71             setResult(RESULT_OK);
72             finish();
73             return false;
74         }
75     }
76 }
77 
78