ホームに戻る
ボタン
package org.example.test;
import android.app.*;
import android.os.*;
import android.view.*;
import android.view.View.*;
import android.widget.*;
public class Button extends Activity
{
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
LinearLayout ll = new LinearLayout(this);
ll.setOrientation(LinearLayout.VERTICAL);
setContentView(ll);
Button bt = new Button(this);
bt.setText("Push");
ll.addView(bt);
bt.setOnClickListener(new SampleClickListener());
}
class SampleClickListener implements OnClickListener
{
public void onClick(View v){
AlertDialog.Builder adlg;
adlg = new AlertDialog.Builder(HelloWorld.this);
adlg.setTitle("Test");
adlg.setMessage("Message");
adlg.setPositiveButton("YES", null);
adlg.show();
}
}
}