Add the standard work-arounds for Android not cleaning up
This commit is contained in:
parent
6cdf9e3e87
commit
b0620637ab
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:hardwareAccelerated="true"
|
android:hardwareAccelerated="true"
|
||||||
|
android:largeHeap="true"
|
||||||
android:icon="@drawable/ic_launcher"
|
android:icon="@drawable/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/AppTheme" >
|
android:theme="@style/AppTheme" >
|
||||||
|
|
|
@ -210,6 +210,9 @@ class GL2JNIView extends GLSurfaceView
|
||||||
setKeepScreenOn(true);
|
setKeepScreenOn(true);
|
||||||
vib=(Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
|
vib=(Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
|
||||||
|
|
||||||
|
Runtime.getRuntime().freeMemory();
|
||||||
|
System.gc();
|
||||||
|
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
touchVibrationEnabled = prefs.getBoolean("touch_vibration_enabled", true);
|
touchVibrationEnabled = prefs.getBoolean("touch_vibration_enabled", true);
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,9 @@ public class InputModFragment extends Fragment {
|
||||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
parentActivity = getActivity();
|
parentActivity = getActivity();
|
||||||
|
|
||||||
|
Runtime.getRuntime().freeMemory();
|
||||||
|
System.gc();
|
||||||
|
|
||||||
mPrefs = PreferenceManager.getDefaultSharedPreferences(parentActivity);
|
mPrefs = PreferenceManager.getDefaultSharedPreferences(parentActivity);
|
||||||
|
|
||||||
String[] controllers = parentActivity.getResources().getStringArray(
|
String[] controllers = parentActivity.getResources().getStringArray(
|
||||||
|
@ -348,6 +351,7 @@ public class InputModFragment extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Drawable getButtonImage(int x, int y) {
|
private Drawable getButtonImage(int x, int y) {
|
||||||
|
System.gc();
|
||||||
try {
|
try {
|
||||||
InputStream bitmap = parentActivity.getAssets().open("buttons.png");
|
InputStream bitmap = parentActivity.getAssets().open("buttons.png");
|
||||||
BitmapFactory.Options options = new BitmapFactory.Options();
|
BitmapFactory.Options options = new BitmapFactory.Options();
|
||||||
|
@ -355,6 +359,7 @@ public class InputModFragment extends Fragment {
|
||||||
Bitmap image = BitmapFactory.decodeStream(bitmap, null, options);
|
Bitmap image = BitmapFactory.decodeStream(bitmap, null, options);
|
||||||
bitmap.close();
|
bitmap.close();
|
||||||
bitmap = null;
|
bitmap = null;
|
||||||
|
System.gc();
|
||||||
Matrix matrix = new Matrix();
|
Matrix matrix = new Matrix();
|
||||||
matrix.postScale(32, 32);
|
matrix.postScale(32, 32);
|
||||||
Bitmap resizedBitmap = Bitmap.createBitmap(image, x, y, 64 / sS,
|
Bitmap resizedBitmap = Bitmap.createBitmap(image, x, y, 64 / sS,
|
||||||
|
|
Loading…
Reference in New Issue