English 中文(简体)
处理甲型六氯环己烷的大型轨道图——大于最大蒸汽
原标题:Handling large bitmaps on Android - int[] larger than max heap size

I m 采用甚大的轨道图和I 储存数据。 图像可能真是大的,我可以压倒这些图像(如果在电线上看到比照图,并把它们放上)。

我的点击问题在幅射极广的轨道图上(比图大小=64MB),我试图在地图上分配面积为16384 000的阵列。 我在三星银星SII上对此进行了测试,该星号应当有足够的记忆来处理这一问题,但似乎在海平面上有“顶”。 这种方法<代码>Runtime.getRuntime().maxMemory() 回归64MB,因此,该特定装置的最大蒸气尺寸就是此。

预报系统水平定为10,因此我可以使用<代码>android:large Heap 属性在其他地方提出(我甚至不知道这是否有助于)。

是否有办法分配超过64名的咨询人? 我尝试在本地分配这些阵列(使用JNINewIntArray功能),但这也失败了。 这似乎受到与jvm相同的限制。

然而,我可以使用<条码>新代谢ByteBuffer在本土一侧分配记忆,但由于这种外围没有阵列的支持,我无法使用<条码>int[](使用<条码>作为IntBuffer(......array)()。 我猜测,开放利比里亚将是一个前进的道路,但我(迄今为止)在开放利比里亚方面有0个经验。

是否有办法让我失踪的记忆得到分配?

最佳回答

因此,我迄今发现的唯一办法是利用国库分配图像。 此外,由于Bitmap没有将现有的Buffer作为“储存”加以使用(方法copyPixelsFromBuffer/code>也受记忆限制;按方法名称加以判断,c份 数据线上。

The solution (I ve only prototyped it roughly) is to malloc whatever the size of the image is, and fill it using c/c++ and then use ByteBuffer in Java with OpenGLES.

目前的原型形成一个简单的图象,并将这一形象作为文本(简而言之,《开放式车辆法》方法将“变形”作为投入使用,似乎按预期运作)。 采用<代码>glTexImage2D的Im将这一缓冲作为正本应用于平面。 这里的样本是,在土著方面分配(并填满)的BoutteBuffer。

int[] textures = new int[1];
gl.glGenTextures(1, textures, 0);
mTextureId = textures[0];
gl.glBindTexture(GL10.GL_TEXTURE_2D, mTextureId);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_REPEAT);
gl.glTexImage2D(GL10.GL_TEXTURE_2D, 0, GL10.GL_RGBA, 4000, 4096, 0, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, mImageData);
问题回答

我假定,欧佩组织已经解决了这一问题,但如果你有一台精炼机,你就可以将比照图输入档案,并用inSampleSize阅读该文档。





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签