我的应用程序关闭 - android.content.res.Resources $ NotFoundException

时间:2017-06-29 20:16:20

标签: android

编辑:GIF图片已更正。 编辑2:我刚刚在AVD上用三星皮肤复制了它!

这是错误:

  

06-30 14:16:03.695 8220-8220 / ar.com.plw.commonwealth E / AndroidRuntime:致命异常:主要                                                                          流程:ar.com.plw.commonwealth,PID:8220                                                                          android.content.res.Resources $ NotFoundException:资源ID#0x7f0c0000                                                                              在android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:190)                                                                              在android.content.res.Resources.getInteger(Resources.java:1055)                                                                              在ar.com.plw.commonwealth.tabs.OstTabFragment.onCreateView(OstTabFragment.java:75)                                                                              在android.support.v4.app.Fragment.performCreateView(Fragment.java:2192)                                                                              在android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1299)                                                                              在android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1528)                                                                              在android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1595)                                                                              在android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:758)                                                                              在android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2363)                                                                              在android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2149)                                                                              在android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2103)                                                                              在android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:1984)                                                                              在android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:626)                                                                              在android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:143)                                                                              在android.support.v4.view.ViewPager.populate(ViewPager.java:1268)                                                                              在android.support.v4.view.ViewPager.populate(ViewPager.java:1116)                                                                              在android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1642)                                                                              在android.view.View.measure(View.java:19857)                                                                              在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6083)                                                                              在android.support.design.widget.CoordinatorLayout.onMeasureChild(CoordinatorLayout.java:714)                                                                              在android.support.design.widget.HeaderScrollingViewBehavior.onMeasureChild(HeaderScrollingViewBehavior.java:90)                                                                              在android.support.design.widget.AppBarLayout $ ScrollingViewBehavior.onMeasureChild(AppBarLayout.java:1391)                                                                              在android.support.design.widget.CoordinatorLayout.onMeasure(CoordinatorLayout.java:784)                                                                              在android.view.View.measure(View.java:19857)                                                                              在android.widget.RelativeLayout.measureChild(RelativeLayout.java:676)                                                                              在android.widget.RelativeLayout.onMeasure(RelativeLayout.java:479)                                                                              在android.view.View.measure(View.java:19857)                                                                              在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6083)                                                                              在android.widget.FrameLayout.onMeasure(FrameLayout.java:185)                                                                              在android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:139)                                                                              在android.view.View.measure(View.java:19857)                                                                              在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6083)                                                                              在android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464)                                                                              在android.widget.LinearLayout.measureVertical(LinearLayout.java:758)                                                                              在android.widget.LinearLayout.onMeasure(LinearLayout.java:640)                                                                              在android.view.View.measure(View.java:19857)                                                                              在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6083)                                                                              在android.widget.FrameLayout.onMeasure(FrameLayout.java:185)                                                                              在android.view.View.measure(View.java:19857)                                                                              在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6083)                                                                              在android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464)                                                                              在android.widget.LinearLayout.measureVertical(LinearLayout.java:758)                                                                              在android.widget.LinearLayout.onMeasure(LinearLayout.java:640)                                                                              在android.view.View.measure(View.java:19857)                                                                              在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6083)                                                                              在android.widget.FrameLayout.onMeasure(FrameLayout.java:185)                                                                              在com.android.internal.policy.DecorView.onMeasure(DecorView.java:689)                                                                              在android.view.View.measure(View.java:19857)                                                                              在android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2275)                                                                              在android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1366)                                                                              在android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1619)                                                                              在android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1254)   06-30 14:16:03.695 8220-8220 / ar.com.plw.commonwealth E / AndroidRuntime:at android.view.ViewRootImpl $ TraversalRunnable.run(ViewRootImpl.java:6337)                                                                              在android.view.Choreographer $ CallbackRecord.run(Choreographer.java:874)                                                                              在android.view.Choreographer.doCallbacks(Choreographer.java:686)                                                                              在android.view.Choreographer.doFrame(Choreographer.java:621)                                                                              在android.view.Choreographer $ FrameDisplayEventReceiver.run(Choreographer.java:860)                                                                              在android.os.Handler.handleCallback(Handler.java:751)                                                                              在android.os.Handler.dispatchMessage(Handler.java:95)                                                                              在android.os.Looper.loop(Looper.java:154)                                                                              在android.app.ActivityThread.main(ActivityThread.java:6119)                                                                              at java.lang.reflect.Method.invoke(Native Method)                                                                              在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:886)                                                                              在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

这是它发生的确切代码:

        Resources resources = getResources();
    RecyclerView.LayoutManager mLayoutManager;
    if (resources.getBoolean(R.bool.isTablet)) {
        //on the following line application crashes.
        mLayoutManager = new StaggeredGridLayoutManager(resources.getInteger(R.integer.columns), StaggeredGridLayoutManager.VERTICAL); 
    } else {
        mLayoutManager = new LinearLayoutManager(getActivity());
    }

有些人告诉我,我的应用程序关闭项目点击。它是RecyclerView。不幸的是,我无法使用我的设备或模拟器重现此问题。

它只是关闭应用程序,没有显示任何错误。

一位好用户发给我这个GIF: enter image description here

这是我的点击监听器:

        viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(final View v) {
            Intent intent = new Intent(context, TabActivity.class);
            Bundle b = new Bundle();
            b.putString("title", filteredItems.get(position).title);
            b.putString("playlist", filteredItems.get(position).playlist);
            imageView.buildDrawingCache();
            Bitmap image = imageView.getDrawingCache();
            b.putParcelable("imageBitmap", image);
            intent.putExtras(b);

            v.getContext().startActivity(intent);
        }
    });

这是我对标签活动的创建:

    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_tab);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            finish();
        }
    });
    Bundle b = getIntent().getExtras();
    title = b.getString("title");
    Bitmap bmp = (Bitmap) b.getParcelable("imageBitmap");
    TextView tabTitle = (TextView) findViewById(R.id.tabTitle);
    ImageView coverImage = (ImageView) findViewById(R.id.tabImage);
    coverImage.setImageBitmap(bmp);
    tabTitle.setText(title);
    tabTitle.setTypeface(null, Typeface.BOLD);
    getSupportActionBar().setTitle(title);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowHomeEnabled(true);

    ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
    setupViewPager(viewPager);

    TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
    tabLayout.setupWithViewPager(viewPager);

    //banners
    mAdView = (AdView) findViewById(R.id.adView);
    AdRequest adRequestBanner = new AdRequest.Builder().build();
    mAdView.loadAd(adRequestBanner);

    // Google Analytics
    AnalyticsApplication application = (AnalyticsApplication) getApplication();
    mTracker = application.getDefaultTracker();

}

有人知道会发生什么吗? 我已经检查了我的清单,如果我得到android:noHistory="true",就像在this post中一样,但是我没有#34;历史记录"我整个项目中的一句话。

此致

0 个答案:

没有答案