Fixing crashes with new encrypt ui

This commit is contained in:
Dominik Schürmann
2015-03-29 20:37:54 +02:00
parent b82f273284
commit 95f1527afe
8 changed files with 70 additions and 43 deletions

View File

@@ -191,9 +191,6 @@ public class NfcHelper {
mNfcAdapter.invokeBeam(mActivity);
}
/**
* A static subclass of {@link Handler} with a {@link WeakReference} to an {@link Activity} to avoid memory leaks.
*/
private static class NfcHandler extends Handler {
private final WeakReference<Activity> mActivityReference;
@@ -203,12 +200,10 @@ public class NfcHelper {
@Override
public void handleMessage(Message msg) {
Activity activity = mActivityReference.get();
if (activity != null) {
if (mActivityReference.get() != null) {
switch (msg.what) {
case NFC_SENT:
Notify.create(activity, R.string.nfc_successful, Notify.Style.OK).show();
Notify.create(mActivityReference.get(), R.string.nfc_successful, Notify.Style.OK).show();
break;
}
}