I have a list view to list some categories. I need to list the products under each category in a new list. I used arrayList to the adapter, I am able to list the category names . but I cant pass the keys (categoryIds) to the next view for getting the products.
Please help me in this regard.
For Now I am trying to display the categoryId in the produts page, but i am not suceeding

the following is the code I tried
public class Categories extends ListActivity {
ArrayList CatList ;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
CatList= GetCategories(); // this returns an Array List
setContentView(R.layout.categories);
setListAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,CatList));
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
// Map map = (Map) l.getItemAtPosition(position);
// Intent intent = (Intent) map.get("intent");
// startActivity(intent);
// super.onListItemClick(l, v, position, id);
Intent i = new Intent(this, Products.class);
// startActivity(i);
i.putExtra("categ",CatList.get(position).toString() );
startActivity(i);
// setContentView(R.layout.products);
}
public static Arraylist GetCategories() {
code to get the array List
}
}
/// following is the products.java
public class Products extends ListActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.products);
TextView CategoryIdtext = (TextView) findViewById(R.id.CategoryId);
Bundle extras = getIntent().getExtras();
CategoryIdtext.setText("CAtegoryID:"+extras.getString("categ"));
}


