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