开发学院手机开发Android 开发 android的一些操作记录 阅读

android的一些操作记录

 2010-05-26 02:19:00 来源:WEB开发网   
核心提示:public void onCreate(Bundle savedInstanceState) {02 super.onCreate(savedInstanceState);03 setContentView(R.layout.main);04 Button button = (Button)findViewById(

public void onCreate(Bundle savedInstanceState) {

02 super.onCreate(savedInstanceState);

03 setContentView(R.layout.main);

04 Button button = (Button)findViewById(R.id.hight);

05 button.setOnClickListener(calc);

06 final String items[] = {"item1","item2","item3","item3","item3","item3","item3",

07"item3","item3","item3","item3","item3","item3"};

08 AlertDialog.Builder ab=new AlertDialog.Builder(this);

09 ab.setTitle("请选择要执行的操作:");

10 ab.setSingleChoiceItems(items, 0,new DialogInterface.OnClickListener() {

11 public void onClick(DialogInterface dialog, int whichButton) {

12 EditText edit = (EditText)findViewById(R.id.edit);

13 // onClick Action

14 //对象选择确定获取whichButton值

15 edit.setText(new Integer(whichButton).toString());

16

17 }

18 })

19

20 .setPositiveButton("确认", new DialogInterface.OnClickListener() {

21 EditText edit = (EditText)findViewById(R.id.edit);

22 public void onClick(DialogInterface dialog, int whichButton) {

23 // on Ok button action

24 edit.setText("0");

25 }

26 })

27 .setNegativeButton("取消", new DialogInterface.OnClickListener() {

28 public void onClick(DialogInterface dialog, int whichButton) {

29 // on cancel button action

30 }

31

32 });

33

34 ab.show();

35 }

36

37 public boolean onCreateOptionsMenu(Menu menu) {

38 super.onCreateOptionsMenu(menu);

39 menu.add(0, 0, 0, "A");

40 menu.add(0, 0, 1, "B");

41 menu.add(0, 0, 0, "C");

42 menu.add(0, 0, 1, "D");

43 menu.add(0, 0, 0, "E");

44 menu.add(0, 0, 1, "F");

1 2  下一页

Tags:android 一些 操作

编辑录入:coldstar [复制链接] [打 印]
[]
  • 好
  • 好的评价 如果觉得好,就请您
      0%(0)
  • 差
  • 差的评价 如果觉得差,就请您
      0%(0)
赞助商链接