SetupWizard: Handle ActivityNotFoundException in LoadingFragment

Handle the possibly thrown ActivityNotFoundException.Changed the generic catch block into a specific catch block to handle ActivityNotFoundException.

Change-Id: Ica1106bab3e569aaa7883898ce6adb3a1a2dd99f
This commit is contained in:
Bharadwaj Narasimha 2016-07-01 13:40:54 -07:00
parent 20037b7ae9
commit 10a58d25fd

View File

@ -16,15 +16,19 @@
package com.cyanogenmod.setupwizard.ui;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import com.cyanogenmod.setupwizard.R;
public class LoadingFragment extends SetupPageFragment {
private StartActivityForResultRunnable mStartActivityForResultRunnable;
private static final String TAG = "LoadingFragment";
@Override
public void startActivityForResult(Intent intent, int requestCode, Bundle options) {
if (isResumed()) {
@ -74,8 +78,12 @@ public class LoadingFragment extends SetupPageFragment {
@Override
public void run() {
mLoadingFragment.startActivityForResult(mIntent, mRequestCode, mOptions);
mLoadingFragment.mStartActivityForResultRunnable = null;
try {
mLoadingFragment.startActivityForResult(mIntent, mRequestCode, mOptions);
}
catch(ActivityNotFoundException e) {
Log.e(TAG,"Activity not found to handle intent "+ mIntent.getDataString());
}
}
}
}