【问题标题】:App error by pressing Home Button按下主页按钮导致应用程序错误
【发布时间】:2015-05-10 17:27:58
【问题描述】:

我开发了一个应用程序,现在,由于我快完成了,我正在修复错误和完善它。目前我遇到的问题是,每当我按下主页按钮时,它都会显示当时屏幕上的任何内容作为我的主屏幕壁纸。我不知道是什么原因造成的,也不知道如何摆脱它,这就是我需要你帮助的原因。

编辑

现在我在我的 GridView 中找到了原因。我不明白为什么它会在这个位置替换我的壁纸,请帮助我。

这里是我填充适配器的代码示例。

c = myDB.rawQuery(sql, null);

        getActivity().startManagingCursor(c);

        adapter = new SimpleCursorAdapter(getActivity().getBaseContext(), R.layout.grid_item, c,
                new String[]{"_id", "name", "thumb_image"}, new int[]{
                R.id.device, R.id.picture}, 0);

        adapter.setViewBinder(new SimpleCursorAdapter.ViewBinder() {
            @Override
            public boolean setViewValue(View view, Cursor theCursor,
                                        int column) {
                int id = view.getId();
                if (id == R.id.device) {
                    final String name = theCursor.getString(1);
                    ((TextView) view).setText(name);
                    return true;
                } else if (id == R.id.picture) {
                    Context context = ((ImageView) view).getContext();
                    int pic_id = context.getResources().getIdentifier(theCursor.getString(2), "drawable", context.getPackageName());
                    ((ImageView) view).setImageResource(pic_id);
                    return true;
                }

                return false;
            }
        });

        gridView.setAdapter(adapter);

【问题讨论】:

    标签: android homescreen android-homebutton


    【解决方案1】:

    我自己解决了一个动画文件的问题:)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-08-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多