我想通过使用捆绑将两个值传递给意图,但是当我单击意图时该值没有传递。下面是这个的源代码:
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);