Search code examples
androidhomescreenandroid-homebutton

App error by pressing Home Button


I developed an app and now, since I am almost finished, I am in the process of fixing bugs and polishing it. At the moment I have the problem that whenever I press the home button it displays whatever was on the screen at that time as my homescreen wallpaper. I have no idea what causes this or how to get rid of it and that's what I need your help for.

Edit

Now i found the reason it is in my GridView. I don't no why it replace my wallpaper on this position, please help me.

Here the code example where i fill the adapter.

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);

by pressing home wallpaper is replaced


Solution

  • Solved problem by my self it was a animation file :)