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