我开发了一个应用程序,现在,因为我差不多完成了,我正在修复错误并抛光它。 目前我遇到的问题是,无论何时按下主页按钮,它都会显示当时屏幕上显示的内容作为我的主屏幕壁纸。 我不知道是什么导致它或如何摆脱它,这就是我需要你的帮助。
编辑
现在我找到了它在我的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);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);最满意答案
我自己解决的问题是动画文件:)
Solved problem by my self it was a animation file :)
更多推荐
发布评论