How to reset the Id of the list_view item in each TabHost?

I have a layout that has two tabs (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 that is in the second tab starts with 1 instead of zero. I know this id is a continuation of the id of the last item of the first tab (as shown in the following images)

Now the question is, how do I get this id to start at zero for each tab ?.

let's look at this part first for populating a list box 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 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 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);

      

tab1

tab2

+3


source to share





All Articles