Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8492423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:42:54+00:00 2026-06-10T22:42:54+00:00

I am creating the custom control in android. That custom control should have the

  • 0

I am creating the custom control in android. That custom control should have the Tab with Webview. If i have used this custom control from user side, then they can access the webview events. I have tried the following,

CustomTab.java

public class CustomTab extends Activity 
{

    TabHost tabHost;

    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        View m_vForm;
        m_vForm = _createTABForm(); 
        addTab("Tab1","Tab1");
        addTab("Tab2","Tab2");
        addTab("Tab3","Tab3");
        addTab("Tab4","Tab4");
        setContentView(m_vForm);  
    }

    /** Create the TAB interface */
    private ViewGroup _createTABForm() {
        // construct the TAB Host
        tabHost = new TabHost(this);
        tabHost.setLayoutParams(
                new LinearLayout.LayoutParams(
                        LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

        // the tabhost needs a tabwidget, that is a container for the visible tabs
        TabWidget tabWidget = new TabWidget(this);
        tabWidget.setId(android.R.id.tabs);
        tabHost.addView(tabWidget, new LinearLayout.LayoutParams(
                  LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); 

        // the tabhost needs a frame layout for the views associated with each visible tab
        FrameLayout frameLayout = new FrameLayout(this);
        frameLayout.setId(android.R.id.tabcontent);
        frameLayout.setPadding(0, 65, 0, 0);
        tabHost.addView(frameLayout, new LinearLayout.LayoutParams(
                  LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));         

        tabHost.setup();        
        return tabHost;
    }


    public void addTab(String tagid, String title)
    {
         // create the tabs
        TabSpec ts1 = tabHost.newTabSpec(tagid);
        ts1.setIndicator(title);
        ts1.setContent(new TabHost.TabContentFactory(){
             public View createTabContent(String tag)
             {               
                    LinearLayout panel = new LinearLayout(CustomTab.this);
                    panel.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, 
                            LayoutParams.WRAP_CONTENT));
                    panel.setOrientation(LinearLayout.VERTICAL);

                    WebView webview=new WebView(CustomTab.this);
                    webview.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT));

                    panel.addView(webview);

                    return panel;
             }  
        }); 
        tabHost.addTab(ts1);
    }
}

If the user passing the url, then it should be loaded in the specific webview, how can i identify which tab is selected, and how to load the url in a corresponding webview.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T22:42:56+00:00Added an answer on June 10, 2026 at 10:42 pm

    I have solved this issue 🙂

    1. I have created 4 instances of WebView from user side class
    2. Passed this with url to create the tab in CustomTab control
    3. Inside the CustomTab, need to set the Content of Tab as this webview instance
    4. After creation of Tab inside the CustomTab, should load this passed Url.
    

    This is working for me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a custom control and I want to have style templates that can
I'm creating a custom control called FooControl derived from ItemsControl have a default style
So I'm creating a custom user control in .NET 2.0 and this user control
I'm creating a custom control with a property that can take value from a
I'm creating a custom control derived from UserControl that I would like to set
I am creating my custom control from scratch. Like a UIScrollView I have to
I am creating a custom control. I want the template for this control to
Im creating a custom control. I have common code for WPF and XBAP application.
I'm working on creating a custom winforms datagridview control that inherits the built in
I'm creating custom control that contain multiple parts. Inside template creation I'm subscribing for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.