Merge "Fix NPE when run the testing in IntentPlayground" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
44b11dd142
@@ -92,4 +92,5 @@
|
||||
<string name="start_mode">Select start mode</string>
|
||||
<string name="start_normal">Start activity</string>
|
||||
<string name="start_for_result">Start activity for result</string>
|
||||
<string name="launch_testing_activities_failed">Start Intent testing failed</string>
|
||||
</resources>
|
||||
|
||||
@@ -27,6 +27,8 @@ import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
@@ -238,8 +240,14 @@ public abstract class BaseActivity extends AppCompatActivity implements
|
||||
}
|
||||
|
||||
protected void runIntentTests() {
|
||||
startActivity(getPackageManager()
|
||||
.getLaunchIntentForPackage("com.example.android.intentplayground.test"));
|
||||
final Intent intent = getPackageManager()
|
||||
.getLaunchIntentForPackage("com.example.android.intentplayground.test");
|
||||
if (intent != null) {
|
||||
startActivity(intent);
|
||||
} else {
|
||||
Toast.makeText(this,
|
||||
R.string.launch_testing_activities_failed, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
||||
protected Intent prepareLaunchForward() {
|
||||
|
||||
Reference in New Issue
Block a user