最近ちょくちょくandroidをやっているので、忘れないようにメモしておきます。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
package com.test.alert
import android.app.Activity;
import android.app.AlertDialog;
import android.os.Bundle;
public class AlertTest extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AlertDialog.Builder ad=new AlertDialog.Builder(this);
ad.setTitle("タイトル");
ad.setMessage("メッセージ");
ad.create();
ad.show();
setContentView(R.layout.main);
}
}
|
こんな感じに書くと、おそらくアラートが表示されるはず。