In general, everything is working on Google Chrome. When the new tab button is clicked, a new tab is generated. In the same way, I want to add a new tab in the Android browser. How to do this — does anyone have any idea?
First, is it possible in Android?
If possible, how to do this?
When I click on the +
button, a new tab should be generated. How to do this?
Create an Activity as below:
Now use @Partik's method to add a new tab, on each + button click:
Ok Here is the code but it's an example only you may need to modify the code as per your requirement. I am giving you all the files code here hope you getting answer.
Your Manifest.xml file
here is your activity_main.xml file for Tab activity
Put your TabWidget into the HorizontalScrollView so when more tabs are add it can scrolling and the Add but is out side of HorizontalScrollView. Every time you click on tab it will add new tab in TabWidget.
Here the code for tab_event.xml This layout will inflate and add into tab. You can change the style and its contain a single Button so you can add drawable image with text also.
Here is your MainActivity.java file
And here is the BlankActivity.java file
For button click create a new tabspec.
Use the following youtube tutorial as reference. Its simple.
http://www.youtube.com/watch?v=NcKSFlYEqYY