按Home键导致应用错误(App error by pressing Home Button)

编程入门 行业动态 更新时间:2024-10-28 04:27:51
按Home键导致应用错误(App error by pressing Home Button)

我开发了一个应用程序,现在,因为我差不多完成了,我正在修复错误并抛光它。 目前我遇到的问题是,无论何时按下主页按钮,它都会显示当时屏幕上显示的内容作为我的主屏幕壁纸。 我不知道是什么导致它或如何摆脱它,这就是我需要你的帮助。

编辑

现在我找到了它在我的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 :)

更多推荐

本文发布于:2023-04-28 02:15:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1329857.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   App   Home   Button   pressing

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!