Fix moreeee bugs
This commit is contained in:
parent
59fde090ad
commit
c3744e2dd0
|
@ -37,9 +37,9 @@ public class PickActivity extends Activity {
|
|||
startActivityForResult(newIntent, 0);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
Log.e(TAG, getString(R.string.no_activity));
|
||||
Toast.makeText(getApplicationContext(), msg, Toast.LENGH_SHORT)
|
||||
.show();
|
||||
setResult(Activity.RESULT_CANCELLED);
|
||||
Toast.makeText(getApplicationContext(), R.string.no_activity,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
setResult(RESULT_CANCELED);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
@ -52,13 +52,13 @@ public class PickActivity extends Activity {
|
|||
|
||||
if (resultCode != RESULT_OK) {
|
||||
Log.d(TAG, "Received resultCode = " + resultCode);
|
||||
setResult(Activity.RESULT_CANCELLED);
|
||||
setResult(RESULT_CANCELED);
|
||||
finish();
|
||||
// probably not necessary but just in case or something
|
||||
return;
|
||||
} else if (data == null) {
|
||||
Log.d(TAG, "Received data = null");
|
||||
setResult(Activity.RESULT_CANCELLED);
|
||||
setResult(RESULT_CANCELED);
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
@ -67,14 +67,14 @@ public class PickActivity extends Activity {
|
|||
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
if (data.getData() != null) {
|
||||
intent.setData(data.getData());
|
||||
setResult(Activity.RESULT_OK, intent);
|
||||
setResult(RESULT_OK, intent);
|
||||
} else if (data.getClipData() != null) {
|
||||
// unsafe?
|
||||
intent.setClipData(data.getClipData());
|
||||
setResult(Activity.RESULT_OK, intent);
|
||||
setResult(RESULT_OK, intent);
|
||||
} else {
|
||||
Log.d(TAG, "Received data.getData() = null and data.getClipData() = null");
|
||||
setResult(Activity.RESULT_CANCELLED);
|
||||
setResult(RESULT_CANCELED);
|
||||
}
|
||||
finish();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue