public boolean onContextItemSelected(MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
m = lv.getAdapter().getItem(info.position).toString();
Toast.makeText(getBaseContext(), "You clicked !"+m, Toast.LENGTH_SHORT).show();
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Are you sure you want to delete this Fixture?");
builder.setCancelable(false);
builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
//listAdapter.remove(m);
Intent i = new Intent(Afc.this.getApplicationContext(), WebViewExample.class);
i.putExtra("Key", m);
startActivity(i);
}
//类新活动的WebView /////////////putExtra字符串意向的Android
Bundle extras = getIntent().getExtras();
String addOn = extras.getStringExtra("key",m);
Toast.makeText(getBaseContext(), "You clicked !"+addOn, Toast.LENGTH_SHORT).show();
你好我传递一个字符串的意图,它给了我一个在getStringExtra(“key”,m);内的变量m上的新活动中发生错误。谁能帮忙?
我这样做是正确的吗?
是和getStringExtra(“key”,m); ???是错误的USE getStringExtra(“key”); – Harinder 2011-04-13 11:25:12
对不起,这只是一个粘贴它的错字,错误表示“m不能解析为变量” – 2011-04-13 11:25:13
感谢Harinder,这是真正的问题。我更新我的答案。 – RoflcoptrException 2011-04-13 11:26:22