好文档 - 专业文书写作范文服务资料分享网站

Android期末考试复习

天下 分享 时间: 加入收藏 我要投稿 点赞

(savedInstanceState); setContentView

username = (EditText) findViewById

submit=(Button)findViewById

userage = (EditText) findViewById show=(Button)findViewById }

@Override

public void onClick(View v) {

(this);

(this);

SharedPreferences share = (FILENAME,;

switch ()) { editor = ();

String name = ().toString().trim(); String age = ().toString().trim();

(\, name); (\, (age)); (); break;

case

case (\, \没有 姓名信息\));

}

(\, 0))); break;

default: }

break;

}

OptionMenu

package class MainActivity extends Activity { private ImageView imageView = null; @Override

protected void onCreate(Bundle savedInstanceState) { (savedInstanceState);

setContentView

imageView = (ImageView) findViewById

@Override

public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate menu); return true;

}

@Override

public boolean onOptionsItemSelected(MenuItem item) { int itemId = ();

if (itemId == {

Resources resources = getBaseContext().getResources();

Drawable btnDrawable =

(btnDrawable);

}

return (item);

}

}

}

ListView

package class MainActivity extends Activity {

private ListView listView = null; @Override

protected void onCreate(Bundle savedInstanceState) { }

@Override

public boolean onCreateOptionsMenu(Menu menu) { }

private List getData() {

List data = new ArrayList(); (\); (\); (\); (\);

getMenuInflater().inflate menu); return true;

(savedInstanceState);

listView = new ListView(this); (new ArrayAdapter(this,

(new ItemClickEvent());

setContentView(listView);

}

return data;

protected class ItemClickEvent implements OnItemClickListener{

@Override

long arg3) {

public void onItemClick(AdapterView<> arg0, View arg1, int arg2,

}

}

}

菜单的创建

package class MainActivity extends Activity {

ListView lv=null;

@Override

protected void onCreate(Bundle savedInstanceState) { (savedInstanceState); lv=new ListView(this); ArrayAdapteradapter= new ArrayAdapter(this, (adapter); setContentView(lv);

}

@Override

public boolean onCreateOptionsMenu(Menu menu) {

ainActivity\ >

Android期末考试复习

(savedInstanceState);setContentViewusername=(EditText)findViewByIdsubmit=(Button)findViewByIduserage=(EditText)findViewByIdshow=(But
推荐度:
点击下载文档文档为doc格式
093qh19qmm9ersa9pruq6ksx797jp100wp5
领取福利

微信扫码领取福利

微信扫码分享