I have one "SubjectTabActivity" and i need to show listview on this activity.
But when i want to implement ListActivity it doesn't show listActivity.
I have two(addchapter,addsubject) xml file with "SubjectTabActivity". and i need to
show my database item il list view in respective xml file. but i don't understand
how to do that?
How to add Listactivity in TabActivity?.
Please give me any reference or code.
Thanks in advance..
Here is my reference code.
public class MasterMainActivity extends TabActivity
{
LayoutInflater layoutInflater = null;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.master);
Intent intent=getIntent();
setResult(RESULT_OK, intent);
layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
TabHost tabHost = getTabHost();
TabHost.TabSpec tab1spec = tabHost.newTabSpec("tabOneSpec");
ImageView imgView = new ImageView(this);
imgView.setBackgroundResource(R.drawable.subject);
tab1spec.setIndicator("Subject", imgView.getBackground());
tab1spec.setContent(new TabContentLayout());
TabHost.TabSpec tab2spec = tabHost.newTabSpec("tabTwoSpec");
tab2spec.setContent(new TabContentLayout());
ImageView imgView1 = new ImageView(this);
imgView1.setBackgroundResource(R.drawable.chapter);
tab2spec.setIndicator("Chapter", imgView1.getBackground());
tabHost.addTab(tab1spec);
tabHost.addTab(tab2spec);
}
private class TabContentLayout implements TabHost.TabContentFactory {
@Override
public View createTabContent(String tag) {
View view = null;
if(tag.equals("tabOneSpec"))
{
try
{
//static final String[] FRUITS = new String[] { "Apple", "Avocado", "Banana",
// "Blueberry", "Coconut", "Durian", "Guava", "Kiwifruit",
//"Jackfruit", "Mango", "Olive", "Pear", "Sugar-apple" };
view = (LinearLayout) layoutInflater.inflate(R.layout.subjecttabview, null);
//setListAdapter(new ArrayAdapter<String>(this, R.layout.subjecttabview,FRUITS));
}
catch(Exception e)
{
e.printStackTrace();
}
}
if(tag.equals("tabTwoSpec"))
{
try
{
view = (LinearLayout) layoutInflater.inflate(R.layout.chaptertabview, null);
}
catch(Exception e)
{
e.printStackTrace();
}
}
return view;
}
}
How to add ListActivity in this TabActivity