即使您已经尝试了一些减少内存使用的方法,捕获OutOfMemoryError是一个好习惯吗?或者我们应该不抓住异常?哪一个更好的做法?
try {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 4;
bitmap = BitmapFactory.decodeFile(file, options);
} catch (OutOfMemoryError e) {
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
谢谢
我的应用程序CursorLoader用于从主表加载数据.数据将ListView在帮助下显示CursorAdapter.ListView中显示的视图还需要子表中的数据.表的关系是一对多的.
如果我在查询期间加入两个表,则组合记录将与子记录一样多,因此ListView,它将在主表中为一个记录显示多个项目.
如果我不加入表,我不确定CursorLoader在通过游标传递数据后检索子记录的最佳方法是什么.有人能帮帮我吗?
从Android 2.0开始,相机API支持少量ColorEffect.
这个列表可以在这里找到,从Effect Aqua开始. http://developer.android.com/reference/android/hardware/Camera.Parameters.html#EFFECT_AQUA
效果可以实现如下:
Camera.Parameters parameters = camera.getParameters();
parameters.setColorEffect(Camera.Parameters.EFFECT_AQUA);
camera.setParameters(parameters);
Run Code Online (Sandbox Code Playgroud)
除了那些支持的效果,我想在我的应用程序中引入Lomo或Retro效果.任何人都可以提供一些如何为相机预览提供额外效果的指导?
代码示例将不胜感激.
谢谢.
默认情况下,进度条很大 ListFragment
ProgressBar progress = new ProgressBar(context, null,
android.R.attr.progressBarStyleLarge);
Run Code Online (Sandbox Code Playgroud)
是使用反射改变它的唯一方法吗?