Android列表视图显示某些设备中的完整项目但缺少不同Android设备中的一些内容

时间:2015-12-08 13:07:11

标签: java android logcat

我想显示一些文件名列表,但有些时候列表中缺少某些文件。但它只发生了一段时间,当时logcat显示了这些东西。

D/ViewGroup(21792): addInArray been called, this = android.widget.TabWidget{41e8d5d8 VFED.... ......ID 0,0-516,0 #1020013 android:id/tabs}call stack =
D/ViewGroup(21792):     java.lang.Throwable: addInArray
D/ViewGroup(21792):     at android.view.ViewGroup.addInArray(ViewGroup.java:3786)
D/ViewGroup(21792):     at android.view.ViewGroup.addViewInner(ViewGroup.java:3740)
D/ViewGroup(21792):     at android.view.ViewGroup.addView(ViewGroup.java:3564)
D/ViewGroup(21792):     at android.view.ViewGroup.addView(ViewGroup.java:3509)
D/ViewGroup(21792):     at android.view.ViewGroup.addView(ViewGroup.java:3485)
D/ViewGroup(21792):     at android.widget.TabWidget.addView(TabWidget.java:490)
D/ViewGroup(21792):     at android.widget.TabHost.addTab(TabHost.java:236)
D/ViewGroup(21792):     at com.app.mbox140.screens.OverflowListSection.createTabs(OverflowListSection.java:426)
D/ViewGroup(21792):     at com.app.mbox140.screens.OverflowListSection$PackageDbCall.onPostExecute(OverflowListSection.java:337)
D/ViewGroup(21792):     at com.app.mbox140.screens.OverflowListSection$PackageDbCall.onPostExecute(OverflowListSection.java:1)
D/ViewGroup(21792):     at android.os.AsyncTask.finish(AsyncTask.java:632)
D/ViewGroup(21792):     at android.os.AsyncTask.access$600(AsyncTask.java:177)
D/ViewGroup(21792):     at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645)
D/ViewGroup(21792):     at android.os.Handler.dispatchMessage(Handler.java:110)
D/ViewGroup(21792):     at android.os.Looper.loop(Looper.java:193)
D/ViewGroup(21792):     at android.app.ActivityThread.main(ActivityThread.java:5292)
D/ViewGroup(21792):     at java.lang.reflect.Method.invokeNative(Native Method)
D/ViewGroup(21792):     at java.lang.reflect.Method.invoke(Method.java:515)
D/ViewGroup(21792):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
D/ViewGroup(21792):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
D/ViewGroup(21792):     at dalvik.system.NativeStart.main(Native Method)

代码我在logcat中发现这个错误如何解决它在android设备kocaso nova一个标签

try
    {
        Logg.getLogger(this.getClass().getName()).info("createTabs() called");
        tabHost = (TabHost) findViewById(android.R.id.tabhost);
        tabHost.setup();
        tabHost.setOnTabChangedListener(OverflowListSection.this);

        final TabWidget tabWidget=tabHost.getTabWidget();
        tabContent = tabHost.getTabContentView();
        tabWidget.removeAllViews();

        try
        {
            tabHost.addTab(tabHost.newTabSpec(LISTUNDELIVERED_TABTAG).setIndicator(getString(R.string.undelivered)).setContent(new TabContentFactory(){
                @Override
                public View createTabContent(String arg0){

                    if(overflowItems.size()>0){
                        listmessage1.setVisibility(View.GONE);
                        return overflowListView;
                    }
                    else{

                        listmessage1.setVisibility(View.VISIBLE);

                        return listmessage1;
                    }

                }
            }));
        }
        catch(Exception e)
        {
        }

        try
        {
            tabHost.addTab(tabHost.newTabSpec(LISTDELIVERED_TABTAG).setIndicator(getString(R.string.delivered)).setContent(new TabContentFactory() {

                @Override
                public View createTabContent(String arg0) {
                    // TODO Auto-generated method stub

                    if(overflowItems_delivered.size()>0){
                        listmessage2.setVisibility(View.GONE);
                        return overflowListView_D;
                    }
                    else{
                        listmessage2.setVisibility(View.VISIBLE);

                        return listmessage2;
                    }

                }
            }));
        }
        catch(Exception e)
        {
        }

        int totalTabs = tabHost.getTabWidget().getChildCount();
        for(int i=0;i<totalTabs;i++)
        {
            tabHost.getTabWidget().getChildAt(i).setBackgroundResource(R.drawable.tab_selector);
        }

        //tabHost.setCurrentTab(1);
        tabHost.setCurrentTab(0);
    }
    catch(Exception e)
    {
    }

0 个答案:

没有答案