allow garbage collection to free handlers

This commit is contained in:
fkloft 2014-01-20 22:37:37 +01:00
parent 787a68ac8d
commit 81aa873e41
2 changed files with 11 additions and 1 deletions

View File

@ -253,6 +253,8 @@ public class IITC_FileManager {
@Override
public void onActivityResult(int resultCode, Intent data) {
mIitc.deleteResponseHandler(this); // to enable garbage collection
try {
if (resultCode == Activity.RESULT_OK && data != null) {
Uri uri = data.getData();
@ -270,8 +272,8 @@ public class IITC_FileManager {
{
encoder.write(c);
}
encoder.close();
mStreamOut.write("');".getBytes());
}

View File

@ -582,6 +582,14 @@ public class IITC_Mobile extends Activity implements OnSharedPreferenceChangeLis
startActivityForResult(launch, RESULT_FIRST_USER + index);
}
public void deleteResponseHandler(ResponseHandler handler) {
int index = mResponseHandlers.indexOf(handler);
if (index != -1) {
// set value to null to enable garbage collection, but don't remove it to keep indexes
mResponseHandlers.set(index, null);
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
int index = requestCode - RESULT_FIRST_USER;