Code example for Intent

Methods: createChooserputExtrasetType

0
        return intent;
    } 
 
    public static Intent newShareIntent(Context context, String subject, String message,
            String chooserDialogTitle) {
        Intent shareIntent = new Intent(Intent.ACTION_SEND);
        shareIntent.putExtra(Intent.EXTRA_TEXT, message);
        shareIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
        shareIntent.setType(MIME_TYPE_TEXT);
        return Intent.createChooser(shareIntent, chooserDialogTitle);
    } 
 
    public static Intent newMapsIntent(String address, String placeTitle) {
        StringBuilder sb = new StringBuilder();
        sb.append("geo:0,0?q=");
 
        String addressEncoded = Uri.encode(address);
        sb.append(addressEncoded);
        // pass text for the info window 
        String titleEncoded = Uri.encode("(" + placeTitle + ")");
Experience pair programming with AI  Get Codota for Java