我想通過使用bundle將兩個值傳遞給intent,但是當我單擊intent時該值不會傳遞。下面是這個源代碼:不能將兩個值傳遞給intent
public static final String ID_EXTRA = "com.example._ID";
protected static final String ID_LISTID = "com.example._ID";
String list = null;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
list = getIntent().getStringExtra(main.ID_EXTRA);
listView = (ListView) findViewById(R.id.productList);
{
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
myid = (int) id;
}
});
}
==============================================================================
Bundle bundle = new Bundle();
bundle.putString(ID_EXTRA, String.valueOf(myid));
bundle.putString(ID_LISTID, list);
editProduct.putExtras(bundle);
startActivity(editProduct);
什麼是'list'包含? – user370305
list = getIntent()。getStringExtra(main.ID_EXTRA); 列表價值,我從主要活動得到的價值.. – johnk