I´m getting out of memory errors on "slower" phones (512mb of RAM).
My app has some tabs on the main activity and in those tabs it has some image buttons that link to a webview.
I think the error comes from loading ALL the images at once, even the ones that aren't seen on the first tab. I already tried the "android:largeHeap="true""
but it still crashes.
Can anyone help me make my app not load images until the tab where those images are is pressed? Changing the visibility to INVISIBLE or GONE
doesn't help either.
EDIT:
I'm loading my images as buttons:
XML:
<Button
android:id="@+id/jn"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginTop="3dp"
android:background="@drawable/b_jn" />
JAVA:
Button bjn = (Button) findViewById(R.id.jn);
bjn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
startActivity(new Intent("applandia.quiosquedigitalfree.JN"));
}
});
Now I have about 50 of these in a row in the same activity. I'm not an expert coder.