I have tried to open the Gmail app via this:
import android.content.Intent;
public class GmailApp {
public static void OpenGmail() {
Intent intent = getPackageManager().getLaunchIntentForPackage("com.google.android.gm");
if(intent != null){
startActivity(intent);
}
}
}
It says it can't find it. But how?
I've read this article right here Can't find getPackageManager() method in android
But I don't understand it.
Can anyone give me an example code that will work?