java putExtra String Intent Android
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/////////////
Bundle extras = getIntent().getExtras();
String addOn = extras.getStringExtra("key",m);
Toast.makeText(getBaseContext(), "You clicked !"+addOn, Toast.LENGTH_SHORT).show();
您好,我正在传递一个带有意图的字符串,它在getStringExtra(“key”,m);”内的变量m上的新活动中给我一个错误;。有人能帮忙吗
我这样做对吗
# 1 楼答案
是的,还有getStringExtra(“键”,m);???是否错误使用getStringExtra(“密钥”)