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

  • Home
  • SEARCH
  • 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 6550789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:15:31+00:00 2026-05-25T12:15:31+00:00

I created an Activity with an invisible TabHost which get’s the content from an

  • 0

I created an Activity with an invisible TabHost which get’s the content from an ListActivity which is filled by my database.
If I open up my Activity with the TabHost in it, i get a Force Close Error. The Problem probably is in my ListActivity.

Here is the Code of my Activity with the Tabhost:

package de.retowaelchli.filterit;


import de.retowaelchli.filterit.stats.CreatedADFilters;
import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TabHost;


public class ADeleteActivity extends TabActivity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.autodelete_test);

        TabHost tabHost = getTabHost();       

        tabHost.addTab(tabHost.newTabSpec("tab1").setIndicator("All AutodeleteFilters").setContent(new Intent(this, CreatedADFilters.class)));
        tabHost.setCurrentTab(0);


    }
    /** Verweise auf die anderen Seiten **/
    public void onClickADConfig(View view){
        final Intent i = new Intent(this, ADFilterConfigActivity.class);
        startActivity(i); }
}

Here’s the Layout-File for it:

<?xml version="1.0" encoding="utf-8"?>


<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/tabcontent"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

       <TabHost xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@android:id/tabhost"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">

        <RelativeLayout
           android:orientation="vertical"
           android:layout_width="fill_parent"
           android:layout_height="fill_parent">
           <FrameLayout
               android:id="@android:id/tabcontent"
               android:layout_width="fill_parent"
               android:layout_height="fill_parent"
               android:layout_weight="1" />
               <TabWidget
                   android:id="@android:id/tabs"
                   android:layout_width="fill_parent"
                   android:layout_height="wrap_content"
                   android:layout_alignBottom = "@android:id/tabcontent" 
                   android:visibility="invisible"/>

                   <TableRow 
                       android:layout_height="wrap_content" 
                       android:id="@+id/ADFilterOverview" 
                       android:layout_width="match_parent" 
                       android:onClick="onClickADConfig" 
                       android:layout_alignParentBottom="true" 
                       android:layout_alignParentLeft="true">

                        <TextView 
                        android:layout_gravity="bottom|left" 
                        android:text="@string/newadfilter" 
                        style="@style/NormalFont"/>
                </TableRow>
       </RelativeLayout>
      </TabHost>  
  </FrameLayout>

Now here you see the Code of my ListActivity:

package de.retowaelchli.filterit.stats;


import de.retowaelchli.filterit.R;
import de.retowaelchli.filterit.database.ADFilterDBAdapter;
import android.app.ListActivity;
import android.database.Cursor;
import android.os.Bundle;
import android.widget.SimpleCursorAdapter;


public class CreatedADFilters extends ListActivity {

    //Variablen deklaration
    private ADFilterDBAdapter mDbHelper;

    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);

        mDbHelper=new ADFilterDBAdapter(this);
        fillData();

    }
    private void fillData() {
        // Get all of the notes from the database and create the item list
        Cursor c = mDbHelper.getAllADFilter();
        startManagingCursor(c);

        String[] from = new String[] { mDbHelper.NAME };
        int[] to = new int[] { R.id.empty };

        // Now create an array adapter and set it to display using our row
        SimpleCursorAdapter adname =
            new SimpleCursorAdapter(this, R.layout.list_layout, c, from, to);
        setListAdapter(adname);
    }
}

And here’s the layout-file for it:

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    style="@style/NormalFont"
    android:id="@+id/empty" >
</TextView>

So what am I doing wrong.. 🙁

Thank you in advance.

Best Regards

safari

Here’s the LogCat.

09-13 14:20:11.652: INFO/ActivityManager(1721): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10100000 cmp=de.retowaelchli.filterit/.StartseiteActivity } from pid 1721
09-13 14:20:11.672: VERBOSE/HtcAppUsageStats(1721): (launch app, package): (Filter It, de.retowaelchli.filterit)
09-13 14:20:11.672: DEBUG/StatusBarManagerService(1721): disable what =0, token = android.os.Binder@40841360, pkg = android, mBar = com.android.internal.statusbar.IStatusBar$Stub$Proxy@40b46bb8
09-13 14:20:11.672: INFO/ActivityManager(1721): Start proc de.retowaelchli.filterit for activity de.retowaelchli.filterit/.StartseiteActivity: pid=3992 uid=10150 gids={}
09-13 14:20:11.812: INFO/SuperPowerSvc(29815): [SuperPowerSvc] App launched: [de.retowaelchli.filterit]
09-13 14:20:12.002: DEBUG/dalvikvm(1721): GC_EXTERNAL_ALLOC freed 1394K, 34% free 10500K/15815K, external 10208K/12256K, paused 147ms
09-13 14:20:12.232: WARN/ResourceType(1721): Skipping entry 0x7f040007 in package table 0 because it is not complex!
09-13 14:20:12.232: WARN/ResourceType(1721): Skipping entry 0x7f040008 in package table 0 because it is not complex!
09-13 14:20:12.272: DEBUG/SurfaceFlinger(1721): layer=0xc46a48 is not in the purgatory list
09-13 14:20:12.292: DEBUG/dalvikvm(3992): GC_EXTERNAL_ALLOC freed 44K, 50% free 2695K/5379K, external 0K/0K, paused 25ms
09-13 14:20:12.442: WARN/InputManagerService(1721): [unbindCurrentClientLocked] Disable input method client.
09-13 14:20:12.442: WARN/InputManagerService(1721): [startInputLocked] Enable input method client.
09-13 14:20:12.512: INFO/ActivityManager(1721): Displayed de.retowaelchli.filterit/.StartseiteActivity: +837ms
09-13 14:20:13.472: INFO/ActivityManager(1721): Starting activity: Intent { cmp=de.retowaelchli.filterit/.ADeleteActivity } from pid 3992
09-13 14:20:13.502: INFO/SuperPowerSvc(29815): [SuperPowerSvc] App launched: [de.retowaelchli.filterit]
09-13 14:20:13.622: DEBUG/dalvikvm(3992): GC_EXTERNAL_ALLOC freed 36K, 49% free 2769K/5379K, external 5760K/7192K, paused 22ms
09-13 14:20:13.742: DEBUG/AndroidRuntime(3992): Shutting down VM
09-13 14:20:13.742: WARN/dalvikvm(3992): threadid=1: thread exiting with uncaught exception (group=0x4001d5a0)
09-13 14:20:13.742: ERROR/AndroidRuntime(3992): FATAL EXCEPTION: main
09-13 14:20:13.742: ERROR/AndroidRuntime(3992): java.lang.RuntimeException: Unable to start activity ComponentInfo{de.retowaelchli.filterit/de.retowaelchli.filterit.ADeleteActivity}: java.lang.RuntimeException: Unable to start activity ComponentInfo{de.retowaelchli.filterit/de.retowaelchli.filterit.stats.CreatedADFilters}: java.lang.NullPointerException
09-13 14:20:13.742: ERROR/AndroidRuntime(3992):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1816)
09-13 14:20:13.742: ERROR/AndroidRuntime(3992):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1837)
09-13 14:20:13.742: ERROR/AndroidRuntime(3992):     at android.app.ActivityThread.access$1500(ActivityThread.java:132)
09-13 14:20:13.742: ERROR/AndroidRuntime(3992):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1033)
09-13 14:20:13.742: ERROR/AndroidRuntime(3992):     at android.os.Handler.dispatchMessage(Handler.java:99)
09-13 14:20:13.742: ERROR/AndroidRuntime(3992):     at android.os.Looper.loop(Looper.java:143)
09-13 14:20:13.742: ERROR/AndroidRuntime(3992):     at android.app.ActivityThread.main(ActivityThread.java:4196)
09-13 14:20:13.742: ERROR/AndroidRuntime(3992):     at java.lang.reflect.Method.invokeNative(Native Method)
09-13 14:20:13.742: ERROR/AndroidRuntime(3992):     at java.lang.reflect.Method.invoke(Method.java:507)
09-13 14:20:13.742: ERROR/AndroidRuntime(3992):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
09-13 14:20:13.742: ERROR/AndroidRuntime(3992):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
09-13 14:20:13.742: ERROR/AndroidRuntime(3992):     at dalvik.system.NativeStart.main(Native Method)
09-13 14:20:13.742: ERROR/AndroidRuntime(3992): Caused by: java.lang.RuntimeException: Unable to start activity ComponentInfo{de.retowaelchli.filterit/de.retowaelchli.filterit.stats.CreatedADFilters}: java.lang.NullPointerException
09-13 14:20:13.742: ERROR/AndroidRuntime(3992):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1816)
09-13 14:20:13.742: ERROR/AndroidRuntime(3992):     at android.app.ActivityThread.startActivityNow(ActivityThread.java:1651)
09-13 14:20:13.742: ERROR/AndroidRuntime(3992):     at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:127)
09-13 14:20:13.742: ERROR/AndroidRuntime(3992):     at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:339)
09-13 14:20:13.742: ERROR/AndroidRuntime(3992):     at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:656)
09-13 14:20:13.742: ERROR/AndroidRuntime(3992):     at android.widget.TabHost.setCurrentTab(TabHost.java:326)
09-13 14:20:13.742: ERROR/AndroidRuntime(3992):     at android.widget.TabHost.addTab(TabHost.java:216)
09-13 14:20:13.742: ERROR/AndroidRuntime(3992):     at de.retowaelchli.filterit.ADeleteActivity.onCreate(ADeleteActivity.java:22)
09-13 14:20:13.742: ERROR/AndroidRuntime(3992):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
09-13 14:20:13.742: ERROR/AndroidRuntime(3992):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1780)
09-13 14:20:13.742: ERROR/AndroidRuntime(3992):     ... 11 more
09-13 14:20:13.742: ERROR/AndroidRuntime(3992): Caused by: java.lang.NullPointerException
09-13 14:20:13.742: ERROR/AndroidRuntime(3992):     at de.retowaelchli.filterit.database.ADFilterDBAdapter.getAllADFilter(ADFilterDBAdapter.java:108)
09-13 14:20:13.742: ERROR/AndroidRuntime(3992):     at de.retowaelchli.filterit.stats.CreatedADFilters.fillData(CreatedADFilters.java:26)
09-13 14:20:13.742: ERROR/AndroidRuntime(3992):     at de.retowaelchli.filterit.stats.CreatedADFilters.onCreate(CreatedADFilters.java:21)
09-13 14:20:13.742: ERROR/AndroidRuntime(3992):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
09-13 14:20:13.742: ERROR/AndroidRuntime(3992):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1780)
09-13 14:20:13.742: ERROR/AndroidRuntime(3992):     ... 20 more
09-13 14:20:13.752: WARN/ActivityManager(1721):   Force finishing activity de.retowaelchli.filterit/.ADeleteActivity
09-13 14:20:13.752: WARN/ActivityManager(1721):   Force finishing activity de.retowaelchli.filterit/.StartseiteActivity
09-13 14:20:14.262: WARN/ActivityManager(1721): Activity pause timeout for HistoryRecord{4058e8d8 de.retowaelchli.filterit/.ADeleteActivity}
09-13 14:20:14.352: WARN/ResourceType(1721): Skipping entry 0x7f040006 in package table 0 because it is not complex!
09-13 14:20:14.352: WARN/ResourceType(1721): Skipping entry 0x7f040005 in package table 0 because it is not complex!

THE POST is updated with new Logcat and overdone code, from your posting’s!

  • 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-25T12:15:31+00:00Added an answer on May 25, 2026 at 12:15 pm

    You are not crated the object for the ADFilterDBAdapter

     public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
    
        mDbHelper=new ADFilterDBAdapter(this);
        fillData();
    
    }
    

    and on more this is as per your code you created only one tab.so set the current tab index to zero(index starts from zero)

    tabHost.setCurrentTab(0);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created an activity which holds 3 custom components (defined in xml). 2 components
I have created an activity which sends a number of notifications to status bar.
I have created a custom workflow activity that copies attachments from a case to
I created an abstract Activity which extends the android.app.Activity. Then I created an activity
I have created following activity package com.ali.test; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import
I have created an activity in which I have created a progress bar as
I've created an activity, which has an expandable list view of category, and some
I'm trying to create an imagebutton to close an ad from admob. I've created
I created an Activity which allows navigating between pages with a couple of Buttons
I am new to android.I created an activity in which i add text view

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.