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 6845829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:32:56+00:00 2026-05-27T00:32:56+00:00

I followed the example in the Android website to create a tab activity with

  • 0

I followed the example in the Android website to create a tab activity with multiple activities. Now I am trying to have it as Single activity and multiple views. I am getting the following exception

Java.lang.RuntimeException : Could not create tab content because could not find the view by id

This is my layout file.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/rootTbl" android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <TabHost android:id="@android:id/tabhost" android:layout_width="fill_parent"
        android:layout_height="fill_parent">
        <LinearLayout android:orientation="vertical"
            android:layout_width="fill_parent" android:layout_height="fill_parent">
            <TabWidget android:id="@android:id/tabs"
                android:layout_width="fill_parent" android:layout_height="wrap_content" />          
            <FrameLayout android:id="@android:id/tabcontent"
                android:layout_width="fill_parent" android:layout_height="wrap_content"
                android:layout_weight="1"/>
                <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/assignedLin" >
                <TextView android:id="@+id/dateassigned" style="@style/deftxtView"/>
                <ListView android:id="@+id/assignedListView" android:layout_width="match_parent" android:layout_height="300dp"/>
                </LinearLayout>     

                <!--TableLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/assignedTbl" >
                <TableRow android:layout_width="fill_parent" android:layout_height="fill_parent">
                    <TextView android:id="@+id/dateassigned" style="@style/deftxtView"/>
                </TableRow>

                <TableRow android:layout_width="fill_parent" android:layout_height="fill_parent">
                <ListView android:id="@+id/assignedListView" android:layout_width="match_parent" android:layout_height="300dp"/>
                </TableRow>
                </TableLayout-->

                <TableLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/acceptedTbl" >
                <TableRow android:layout_width="fill_parent" android:layout_height="fill_parent">
                    <TextView android:id="@+id/dateaccepted" style="@style/deftxtView"/>
                </TableRow>

                <TableRow android:layout_width="fill_parent" android:layout_height="fill_parent">
                <ListView android:id="@+id/acceptedListView" android:layout_width="match_parent" android:layout_height="300dp"/>
                </TableRow>
                </TableLayout>
        </LinearLayout>
    </TabHost>
</LinearLayout>

this is my java file

package com.tcs.mServices;

import java.util.ArrayList;

import com.tcs.mLib.DBAdapter;
import com.tcs.mServicesBO.FFA_CONTACT_DETAILS;
import com.tcs.mServicesBO.FFA_SERVICE_REQUEST;

import android.app.TabActivity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.database.Cursor;
import android.os.Bundle;
import android.widget.ListView;
import android.widget.TabHost;
import android.widget.TextView;
import android.widget.TabHost.OnTabChangeListener;

public class TabActivityScreen extends TabActivity {

    private static DBAdapter dbAdapter;
    private static Context context;
    private static InteractiveAdapter interactiveAdapter;
    private static ListView assignedListView;

    /** Called when the activity is first created. */
    @SuppressWarnings("unchecked")
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.tabactivityscreen);

        ArrayList<FFA_SERVICE_REQUEST> ffa_Service_Requests=(ArrayList<FFA_SERVICE_REQUEST>) this.getIntent().getExtras().get("ffa_service_RequestBO");
        ArrayList<FFA_CONTACT_DETAILS> ffa_Contact_Details=(ArrayList<FFA_CONTACT_DETAILS>) this.getIntent().getExtras().get("ffa_Contact_DetailsBO");

    /* 
     * Tab Related Code
     * 
     */ 


    Resources res = getResources(); // Resource object to get Drawables
    final TabHost tabHost = getTabHost();  // The activity TabHost       
    TabHost.TabSpec spec;  // Resusable TabSpec for each tab
    final Intent assignedIntent;  // Reusable Intent for each tab
    final Intent acceptedIntent;
    final Intent returnedIntent;
    final Intent completedIntent;



    // Create an Intent to launch an Activity for the tab (to be reused)
    assignedIntent = new Intent().setClass(this, AssignedActivity.class);
    assignedIntent.putExtra("ffa_service_RequestBO", ffa_Service_Requests);
    assignedIntent.putExtra("ffa_Contact_DetailsBO", ffa_Contact_Details);

    // Initialize a TabSpec for each tab and add it to the TabHost
   /* spec = tabHost.newTabSpec("ASSIGNED").setIndicator("Assigned")
                  .setContent(assignedIntent);*/
    spec = tabHost.newTabSpec("ASSIGNED").setIndicator("Assigned")
    .setContent(R.id.assignedLin);
    tabHost.addTab(spec);   


    acceptedIntent = new Intent().setClass(this, AcceptedActivity.class);

    // Initialize a TabSpec for each tab and add it to the TabHost
/*    spec = tabHost.newTabSpec("ACCEPTED").setIndicator("Accepted")
                  .setContent(acceptedIntent);*/
    spec = tabHost.newTabSpec("ACCEPTED").setIndicator("Accepted")
    .setContent(R.id.acceptedTbl);
    tabHost.addTab(spec);

    returnedIntent = new Intent().setClass(this, ReturnedActivity.class);
    spec = tabHost.newTabSpec("RETURNED").setIndicator("Returned")
                        .setContent(returnedIntent);
    tabHost.addTab(spec);

    completedIntent = new Intent().setClass(this, CompletedActivity.class);
    spec = tabHost.newTabSpec("COMPLETED").setIndicator("Completed")
                        .setContent(completedIntent);
    tabHost.addTab(spec);

    tabHost.getTabWidget().getChildAt(0).getLayoutParams().height=75;
    tabHost.getTabWidget().getChildAt(1).getLayoutParams().height=75;
    tabHost.getTabWidget().getChildAt(2).getLayoutParams().height=75;
    tabHost.getTabWidget().getChildAt(3).getLayoutParams().height=75;

    tabHost.setCurrentTab(0);

    tabHost.setOnTabChangedListener(new OnTabChangeListener(){
        public void onTabChanged(String tabId){
            if("ASSIGNED".equals(tabId)){
                tabHost.setCurrentTabByTag(tabId);
            }else if("ACCEPTED".equals(tabId)){
                tabHost.setCurrentTabByTag(tabId);
            }
        }
    });  


    }

}

I had it like many activities for the tabs. While trying to make it as views getting some problem. Pls help

  • 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-05-27T00:32:56+00:00Added an answer on May 27, 2026 at 12:32 am

    TabContent does not have assignedLin as its child. Include assignedLin in FrameLayout. Right now it is not.

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

Sidebar

Related Questions

I followed the example at http://www.emanueleferonato.com/2007/08/19/managing-ball-vs-ball-collision-with-flash/ to create ball collision on Android, my code
I am trying to implement this example http://www.javacodegeeks.com/2011/02/android-google-maps-tutorial.html and i have followed exactly all
I'm trying to understand how testing can be applied in android and have followed
I have followed the Hello World example from Google's Android developer's guide. When I
I followed their how-to: Phonegap Start Phonegap wiki I have succesfully installed the android
I have followed the Local Service example provided by Google, but my Context::bindService(...) always
I followd the android tutorial from: Android Develoer - CursorLoader example Im getting the
I have followed the example in for the gradient dividers: http://www.connorgarvey.com/blog/?p=34 I have tried
I have started teaching myself about the Android NDK and I have followed this
I've followed the tutorial here: http://developer.android.com/resources/tutorials/views/hello-gridview.html I'm wondering how I get place text over

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.