mirror of
https://github.com/oasisfeng/deagle.git
synced 2025-01-09 04:10:03 +08:00
ADD: Activities.startActivity().
This commit is contained in:
parent
3bd20c3e22
commit
2ed9ab582c
@ -5,6 +5,7 @@ import android.app.Application;
|
||||
import android.app.Service;
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.content.Intent;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
/**
|
||||
@ -22,4 +23,10 @@ public class Activities {
|
||||
if (base_context == context) return null;
|
||||
return findActivityFrom(base_context);
|
||||
}
|
||||
|
||||
public static void startActivity(final Context context, final Intent intent) {
|
||||
final Activity activity = findActivityFrom(context);
|
||||
if (activity != null) activity.startActivity(intent);
|
||||
else context.startActivity(intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user