I have a layout in which there is two tab(implemented by "TabHost"), and in each tab I have a list_view with one item. as I found, the Id of the first item in the list_view which is in the second tab, starts from 1 instead of zero. I know this id is the continuation of the id of the last item of the first tab (As shown in the following images)
Now the question is How to make these id to start from zero for each tab? .
first consider this part for filling list view in All Tabs.
// Tab1
TabHost.TabSpec LawSpec = tabHost.newTabSpec(Law_SPEC);
LawSpec.setIndicator(Law_SPEC, getResources().getDrawable(R.drawable.searchimg));
Intent LawIntent = new Intent(ListResult.this, LawResult.class);
LawIntent.putExtra("Lawlist", LawList);
LawSpec.setContent(LawIntent);
// Tab2
TabHost.TabSpec ArticleSpec = tabHost.newTabSpec(Article_SPEC);
ArticleSpec.setIndicator(Article_SPEC, getResources().getDrawable(R.drawable.searchimg));
Intent ArticleIntent = new Intent(ListResult.this, ArticleResult.class);
ArticleIntent.putExtra("Articlelist", ArticleList);
ArticleSpec.setContent(ArticleIntent);
And in each Tab I have a ListAdapter:
// Tab1's List
ListAdapter adapter = new SimpleAdapter(
LawResult.this, LawList, R.layout.law_result_item,
new String[]{"selectedId", TAG_body, TAG_tag},
new int[]{R.id.idL, R.id.body, R.id.tags}
);
setListAdapter(adapter);
// Tab2's List Adapter
ListAdapter adapter = new SimpleAdapter(
ArticleResult.this, ArticleList, R.layout.article_result_item,
new String[]{"selectedId", TAG_body, TAG_tag},
new int[]{R.id.idA, R.id.body, R.id.tags}
);
setListAdapter(adapter);

