Manifest. Memory

Hello. I heard that manifest can be slightly modified and android will increase the available memory for the application. Can you indicate what exactly and how to change?
Thanks in advance.

Hi.
I think you need to write android:largeHeap=“true”>
between the application tags.
Something like:

  <application android:allowBackup="true" 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/title">
     android:largeHeap="true">
     <activity android:name="com
     etc.
      </activity>
  </application>

@NoName === @noel is right; yet be prudent with this tag, it slows a lot your work and it increases the risk for OutOfMemory error or that the android framework kills your running process; generally this tag has to be used when you have a lot of bitmaps and if it is not the case you can use other components callback as onLowMemory() for clearing the cache and free Ram.

I will try to use onLowMemory () when I figure it out.

But I sincerely do not understand why android gives so little memory to my application?
Only 5-10 pictures are not of the best quality and writes:
java.lang.OutOfMemoryError: Failed to allocate a 16000019 byte allocation with 2456824 free bytes and 2MB until OOM, max allowed footprint 201326592, growth limit 201326592
at dalvik.system.VMRuntime.newNonMovableArray (Native Method)
at java.nio.DirectByteBuffer $ MemoryRef. (DirectByteBuffer.java:71)
at java.nio.ByteBuffer.allocateDirect (ByteBuffer.java:257)
at processing.opengl.PGL.allocateDirectIntBuffer (PGL.java:2466)
at processing.opengl.PGL.updateIntBuffer (PGL.java:2496)
at processing.opengl.Texture.updatePixelBuffer (Texture.java:793)
at processing.opengl.Texture.set (Texture.javahaps45)

I delete (set to null) all my images ,as soon as I can.

1 Like

@NoName === it s difficult to help you much more without knowing when and how you load your images and what is the size and weight for them; try to be more precise and put some sample code; if you can put your images for downloading

So, I created project (with all files) an archive, with access by reference.
I hope it will be convenient for you to receive information in this way.

Sorry, it’s not always possible to answer immediately or even on the first day.
Thank you very much for your help.

Link:

@NoName ===
i have downloaded your folder, but either the archive is corrupted or the structure is not ok, why i dont know: i get the data folder and the main which seems to be “core.pde” but it has no classes and the other files are also .pde (but not classes) ; not any manifest.Try to send again not with googledrive but with dropBox.

Wait. Maybe the archive is correct? I’m writing code from the telephone APDE.
I am enclosing screenshots of the contents of the folder.

Core this is the main file.

Using APDE as well.
In order to run your sketch I needed to use the default renderer. (without P2D). Otherwise it will crash as soon as the background image is set. There is also an issue when you re-run the sketch after pressing the back button. If I remember well it has something to do with re-utilizing bitmaps. I don’t remember how I solved this at the moment. I’ll search in my codes later on.

PS I copied the code to a new sketch without changing its auto generated manifest file.

Many thanks.
As I understand it, you just need to set the default render. It seems to me that P2D is not needed in this project.
I’ll try and unsubscribe if there will be more failures, if you’re interested.

And since you’re here))))
I will not begin to create a topic for a small question … but now I was looking at the forum for an answer to whether it is possible to put my gameplay folder (for example) in the data folder and extract files from the gameplay folder itself?
Most likely, you can.
I tried the code (example below) in different variations, but nothing came of it. Moreover, somewhere I read a post about the path separator, but completely forgot the details …
If you know the answer, tell me, please.

Code example:
docContinuePlay=loadStrings(“data/gameplay/docContinuePlay.txt”);

No. You can’t save strings to your data folder.
Here you can find the code I wrote, to write strings to a folder.

1 Like

Thank you. i will try to use this)

@NoName ===
I understand now that you are using APDE, i know nothing about APDE, which probably explains that i was surprised by the structure of your folder; anyway in the archive that i have downloaded i cannot see the .txt (mainru) which is in your picture

@noel === @noName is not asking tosave but to loadStrings from a subfolder (if i dont mistake!) and that is absolutely possible… Second point is that you CAN saveStrings (or table, or what you want) to your data folder, but not with your code which uses externalStorageDirectory (and is good for that); if you want to save to the data folder you have to use assetsManager and get the path to your privateDir.

You are right. I was taking one step further, because it is a game, and I assume that he wants to save results and settings for the player. I have not tried the assetsManager for this (saving), because I thought the device would have to be rooted in that case. That is why I think saving to the SD is the easiest way. Of course loading strings is no problem.

@akenaton I’ve googled a bit and it is said that assets are read only, but you can append/format a string called by res/values/strings.xml Is that what you are suggesting?

@noel === of course assets are read only; but you can open them with AssetManager, then modify && copy them to another location which can be your private data folder (getFileDir()) or the externalStorageDirectory( as you have done); as for saving something like a score Preferences is the better way.

1 Like