Hello! I build my personal web browser using tabs .When I close a tab and
click on the tab that is currently open then the contents of the closed tab
appear in the current tab.
The code of creating and deleting a tab:
private void addMethod() {
//tring webSiteName = getHost("http://www.google.com");
Intent openBrowser = new Intent();
openBrowser.setClass(this, WebBrowser.class);
tabHost.addTab(tabHost.newTabSpec("http://www.google.gr" +
Integer.toString(z)).setIndicator("ΚΑΡΤΕΛΑ ").setContent(openBrowser));
tabHost.setCurrentTab(z);
Log.d("z",Integer.toString(z));
++z;
}
private void deleteMethod() {
// Since we can't really delete a TAB
// We hide it
int position = tabHost.getCurrentTab();
Log.d("Position",Integer.toString(position));
if (position != 0 ) {
tabHost.getCurrentTabView().setVisibility(1);
tabHost.setCurrentTab(position-1);
}
else if(position== z){
tabHost.getCurrentTabView().setVisibility(1);
tabHost.setCurrentTab(position+1);
}
Log.d("Z val in delete()",Integer.toString(z));
if(position >0)
{
tabHost.getCurrentTabView().setVisibility(View.GONE);
tabHost.setCurrentTab(position+1);
z-=1;
if(z<0)
z=0;
}
else if(position == 0)
{
tabHost.getCurrentTabView().setVisibility(View.GONE);
tabHost.setCurrentTab(position+1);
z=0;
}
else if(position == z)
{
tabHost.getCurrentTabView().setVisibility(View.GONE);
tabHost.setCurrentTab(z-1);
Log.d("Z value in final","lol");
Log.d("Pos",Integer.toString(position));
Log.d("z pos",Integer.toString(z));
z--;
}
please help me
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.