我有一个列表视图,每行有几个图像按钮.单击列表行时,将启动新活动.由于相机布局有问题,我不得不建立自己的标签.为结果启动的活动是地图.如果我单击我的按钮启动图像预览(从SD卡加载图像),应用程序将从活动返回到活动返回到listview结果处理程序以重新启动我的新活动,这只是一个图像小部件.
列表视图上的图像预览正在使用光标和ListAdapter.这使得它非常简单,但我不确定如何放置一个经过调整大小的图像(即小的像素大小不像动态src图像按钮那样.所以我只是调整了从手机摄像头下来的图像.
问题是当我试图返回并重新启动第二个活动时,我收到内存不足错误.
这是更好的,因为我还需要对每行中的小部件/元素的属性进行一些更改,因为焦点问题我无法选择带触摸屏的行.(我可以用滚球.)
一旦我在列表视图上禁用了图像,它再次正常工作.
仅供参考:这就是我的做法:
String[] from = new String[] { DBHelper.KEY_BUSINESSNAME,DBHelper.KEY_ADDRESS,DBHelper.KEY_CITY,DBHelper.KEY_GPSLONG,DBHelper.KEY_GPSLAT,DBHelper.KEY_IMAGEFILENAME + ""};
int[] to = new int[] {R.id.businessname,R.id.address,R.id.city,R.id.gpslong,R.id.gpslat,R.id.imagefilename };
notes = new SimpleCursorAdapter(this, R.layout.notes_row, c, from, to);
setListAdapter(notes);
Run Code Online (Sandbox Code Playgroud)
哪里R.id.imagefilename是ButtonImage.
这是我的LogCat:
01-25 05:05:49.877: ERROR/dalvikvm-heap(3896): 6291456-byte external allocation too large for this process.
01-25 05:05:49.877: ERROR/(3896): VM wont let us allocate 6291456 bytes
01-25 05:05:49.877: ERROR/AndroidRuntime(3896): Uncaught handler: thread main exiting due to …Run Code Online (Sandbox Code Playgroud)
我不知道发生了什么,起初它现在正在运行我有这个错误这是我的代码:
我不知道发生了什么,起初它现在正在运行我有这个错误这是我的代码:
我不知道发生了什么,起初它现在正在运行我有这个错误这是我的代码:
public void allFile() {
mTempDir = Environment.getExternalStorageDirectory()
+ "/MyCameraBooth/Photo/";
File mTempFile = new File(mTempDir);
if (!mTempFile.exists()) {
mTempFile.mkdirs();
}
mBackground = Bitmap.createBitmap(1800, 1200, Bitmap.Config.RGB_565);
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
File f = new File(AppConstant.filepathone);
Bitmap mImageone = decodeFile(f);
File g = new File(AppConstant.filepathtwo);
Bitmap mImagetwo = decodeFile(g);
File h = new File(AppConstant.filepaththree);
Bitmap mImagethree = decodeFile(h);
File i = new File(AppConstant.filepathfour);
Bitmap mImagefour = decodeFile(i);
Map<String, Bitmap> mBgMap = new HashMap<String, Bitmap>();
mBgMap.put("Frame1", BitmapFactory.decodeResource(getResources(), …Run Code Online (Sandbox Code Playgroud)