1 |
package soo.elements.activity; |
---|
2 |
|
---|
3 |
import android.app.Activity; |
---|
4 |
import android.app.AlertDialog; |
---|
5 |
import android.content.DialogInterface; |
---|
6 |
import android.content.Intent; |
---|
7 |
import android.os.Bundle; |
---|
8 |
import android.util.Log; |
---|
9 |
import android.view.View; |
---|
10 |
import android.view.View.OnClickListener; |
---|
11 |
import android.widget.Button; |
---|
12 |
import android.widget.Toast; |
---|
13 |
|
---|
14 |
public class LifeCycleTest extends Activity { |
---|
15 |
/** Called when the activity is first created.(硫�え由ъ� 留����吏��) */ |
---|
16 |
|
---|
17 |
private final String KIND ="Main-Activity"; |
---|
18 |
@Override |
---|
19 |
public void onCreate(Bundle savedInstanceState) { |
---|
20 |
super.onCreate(savedInstanceState); |
---|
21 |
Log.i(KIND,"onCreate()"); |
---|
22 |
setContentView(R.layout.main); |
---|
23 |
|
---|
24 |
Button b1 = (Button)findViewById(R.id.button01); |
---|
25 |
Button b2 = (Button)findViewById(R.id.button02); |
---|
26 |
|
---|
27 |
b1.setOnClickListener(new OnClickListener() { |
---|
28 |
|
---|
29 |
@Override |
---|
30 |
public void onClick(View v) { |
---|
31 |
// ��� Activity濡��대������以��. |
---|
32 |
Intent i = new Intent(LifeCycleTest.this,SubActivity.class); |
---|
33 |
startActivity(i); //intent : �ъ����濡�����쇨� ���. |
---|
34 |
} |
---|
35 |
}); |
---|
36 |
|
---|
37 |
b2.setOnClickListener(new OnClickListener() { |
---|
38 |
|
---|
39 |
@Override |
---|
40 |
public void onClick(View v) { |
---|
41 |
// TODO Auto-generated method stub |
---|
42 |
AlertDialog.Builder ad = new AlertDialog.Builder(LifeCycleTest.this); |
---|
43 |
ad.setTitle("���李���ぉ"); |
---|
44 |
ad.setMessage("���李��댁�"); |
---|
45 |
ad.setNeutralButton("�リ린",new DialogInterface.OnClickListener() { |
---|
46 |
@Override |
---|
47 |
public void onClick(DialogInterface dialog, int which) { |
---|
48 |
|
---|
49 |
} |
---|
50 |
}); |
---|
51 |
ad.show(); |
---|
52 |
} |
---|
53 |
}); |
---|
54 |
} |
---|
55 |
|
---|
56 |
@Override |
---|
57 |
public void onStart(){ //�ъ������ �������렐�����蹂대� �ш���媛�������. |
---|
58 |
super.onStart(); |
---|
59 |
Log.i(KIND,"onStart()"); |
---|
60 |
} |
---|
61 |
|
---|
62 |
@Override |
---|
63 |
public void onResume(){ //�ъ������ �������렐�����蹂대� �ш���媛�������. |
---|
64 |
super.onResume(); |
---|
65 |
Log.i(KIND,"onResume()"); |
---|
66 |
} |
---|
67 |
|
---|
68 |
@Override |
---|
69 |
public void onPause(){ //�ъ������ �������렐�����蹂대� �ш���媛�������. |
---|
70 |
super.onPause(); |
---|
71 |
Log.i(KIND,"onPause()"); |
---|
72 |
} |
---|
73 |
|
---|
74 |
@Override |
---|
75 |
public void onStop(){ //�ъ������ �������렐�����蹂대� �ш���媛�������. |
---|
76 |
super.onStop(); |
---|
77 |
Log.i(KIND,"onStop()"); |
---|
78 |
} |
---|
79 |
|
---|
80 |
@Override |
---|
81 |
public void onDestroy(){ //�ъ������ �������렐�����蹂대� �ш���媛�������. |
---|
82 |
super.onDestroy(); |
---|
83 |
Log.i(KIND,"onDestroy()"); |
---|
84 |
} |
---|
85 |
} |
---|