import android.app.*;
import android.os.*;
import android.util.*;
import android.widget.*;
public class LifeCycleTest extends Activity
{
StringBuilder builder = new StringBuilder();
TextView textView;
private void log(String text)
{
Log.d("LifeCycleTest", text);
builder.append(text);
builder.append('\n');
textView.setText(builder.toString());
}
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
textView = new TextView(this);
textView.setText(builder.toString());
setContentView(textView);
}
@Override
public void onResume()
{
super.onResume();
log("resume");
}
@Override
protected void onPause()
{
super.onPause();
log("paused");
if(isFinishing())
{
log("finishing");
}
}
}
import android.os.*;
import android.util.*;
import android.widget.*;
public class LifeCycleTest extends Activity
{
StringBuilder builder = new StringBuilder();
TextView textView;
private void log(String text)
{
Log.d("LifeCycleTest", text);
builder.append(text);
builder.append('\n');
textView.setText(builder.toString());
}
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
textView = new TextView(this);
textView.setText(builder.toString());
setContentView(textView);
}
@Override
public void onResume()
{
super.onResume();
log("resume");
}
@Override
protected void onPause()
{
super.onPause();
log("paused");
if(isFinishing())
{
log("finishing");
}
}
}
'코드조각모음' 카테고리의 다른 글
[android003] 멀티 터치 예제 (0) | 2011.11.06 |
---|---|
[android002] 싱글 터치 예제 (0) | 2011.11.06 |
[Java006] Boxing & Unboxing (0) | 2011.10.12 |
[Java005] Primitive 데이터 타입 (0) | 2011.10.12 |
[Java004] 상수 사용하기 (0) | 2011.10.11 |