I have custom app class
public class MyApp extends Application {
public static Context application_context;
@Override
public void onCreate() {
super.onCreate();
application_context=getApplicationContext();
}
public static void startShareIntent() {
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_TEXT, "some text");
shareIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
shareIntent.putExtra(Intent.EXTRA_SUBJECT, "subject");
application_context.startActivity(Intent.createChooser(shareIntent,
"Share with"));
}
}
and when I call this method I receive this error message
"Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?"
YES it is that what really want but why I can not do it ?