In my application, I'm creating dynamic tabs.Inside framelayout I've created a edittext.For each tab i create content of tab will be edittext. When i type in editext of one tab and later if i create a new tab and when I switch between these tabs, it shows the content of editext as empty.
Update:
I don't want to create a separate activity for each tab.I'l explain along with the code.
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final TabHost tabs = (TabHost)this.findViewById(R.id.tabs);
tabs.setup();
TabHost.TabSpec spec1=tabs.newTabSpec(f);
spec1.setContent(R.id.content1);
spec1.setIndicator(f);
tabs.addTab(spec1);
tabs.setCurrentTab(i);
list.add(spec1);
i++;
Addbtn.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View arg0)
{
final TabHost tabs = (TabHost)this.findViewById(R.id.tabs);
tabs.setup();
TabHost.TabSpec spec1=tabs.newTabSpec(f);
spec1.setContent(R.id.content1);
spec1.setIndicator(f);
tabs.addTab(spec1);
tabs.setCurrentTab(i);
list.add(spec1);
i++;
});
Default one tab will be there. here content of tab is edittext. When i click on button new tab will be created. problem is with the content of tab. In default tab if i type in edittext, and create a new tab and switch to the default tab the content of default would be lost.