I have a service class.I need to share my few details through Facebook,whatsapp,gmail,yahoo etc.But when i tried share intent i getting an error
android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
Below is my code
shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
startActivity(Intent.createChooser(shareIntent,"Share via"));
shareIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Log.e("clicked","clicked>>>>>>share");
Please give me a solution