public class IntentUtils
extends java.lang.Object
| Constructor and Description |
|---|
IntentUtils() |
| Modifier and Type | Method and Description |
|---|---|
static android.content.Intent |
callPhone(java.lang.String phoneNumber)
Calls the entered phone number.
|
static android.content.Intent |
cropImage(android.content.Context context,
java.io.File image,
int outputX,
int outputY,
int aspectX,
int aspectY,
boolean scale)
Crop image.
|
static android.content.Intent |
dialPhone(java.lang.String phoneNumber)
Dials (but does not actually initiate the call) the number given.
|
static android.content.Intent |
findLocation(java.lang.String query)
Opens the Maps application to the given query.
|
static boolean |
isCropAvailable(android.content.Context context)
Check that cropping application is available
|
static boolean |
isIntentAvailable(android.content.Context context,
android.content.Intent intent)
Check that in the system exists application which can handle this intent
|
static android.content.Intent |
openAudio(java.io.File file)
Open an audio file in appropriate app
|
static android.content.Intent |
openAudio(java.lang.String file) |
static android.content.Intent |
openAudio(android.net.Uri uri) |
static android.content.Intent |
openImage(java.io.File file) |
static android.content.Intent |
openImage(java.lang.String file)
Open an image file in appropriate app
|
static android.content.Intent |
openImage(android.net.Uri uri) |
static android.content.Intent |
openLink(java.lang.String url)
Open a browser window to the URL specified.
|
static android.content.Intent |
openLink(java.net.URL url) |
static android.content.Intent |
openPlayStore(android.content.Context context)
Open app page at Google Play.
|
static android.content.Intent |
openPlayStore(android.content.Context context,
boolean openInBrowser)
Open app page at Google Play
|
static android.content.Intent |
openText(java.io.File file) |
static android.content.Intent |
openText(java.lang.String file)
Open a text file in appropriate app
|
static android.content.Intent |
openText(android.net.Uri uri) |
static android.content.Intent |
openVideo(java.io.File file)
Open a video file in appropriate app
|
static android.content.Intent |
openVideo(java.lang.String file) |
static android.content.Intent |
openVideo(android.net.Uri uri) |
static android.content.Intent |
photoCapture(java.lang.String file)
Call standard camera application for capturing an image
|
static android.content.Intent |
pick(java.lang.String mimeType)
Pick a type of file from the sdcard with the file manager.
|
static android.content.Intent |
pickContact()
Pick contact from phone book
|
static android.content.Intent |
pickContact(java.lang.String scope)
Pick contact from phone book
|
static android.content.Intent |
pickFile()
Pick file from sdcard with file manager.
|
static android.content.Intent |
pickImage()
Pick image from gallery
|
static android.content.Intent |
sendEmail(java.lang.String[] to,
java.lang.String subject,
java.lang.String text) |
static android.content.Intent |
sendEmail(java.lang.String to,
java.lang.String subject,
java.lang.String text)
Send email message
|
static android.content.Intent |
sendSms(java.lang.String to,
java.lang.String message)
Send SMS message using built-in app
|
static android.content.Intent |
shareText(java.lang.String subject,
java.lang.String text)
Share text via thirdparty app like twitter, facebook, email, sms etc.
|
static android.content.Intent |
showLocation(float latitude,
float longitude,
java.lang.Integer zoomLevel)
Opens the Maps application to the given location.
|
static android.content.Intent |
showLocationServices()
Open system settings location services screen for turning on/off GPS
|
static android.content.Intent |
showStreetView(float latitude,
float longitude,
java.lang.Float yaw,
java.lang.Integer pitch,
java.lang.Float zoom,
java.lang.Integer mapZoom)
Opens the Street View application to the given location.
|
public static android.content.Intent openPlayStore(android.content.Context context)
context - Application contextpublic static android.content.Intent openPlayStore(android.content.Context context,
boolean openInBrowser)
context - Application contextopenInBrowser - Should we try to open application page in web browser
if Play Store app not found on devicepublic static android.content.Intent sendEmail(java.lang.String to,
java.lang.String subject,
java.lang.String text)
to - Receiver emailsubject - Message subjecttext - Message bodysendEmail(String[], String, String)public static android.content.Intent sendEmail(java.lang.String[] to,
java.lang.String subject,
java.lang.String text)
sendEmail(String, String, String)public static android.content.Intent shareText(java.lang.String subject,
java.lang.String text)
subject - Optional subject of the messagetext - Text to sharepublic static android.content.Intent sendSms(java.lang.String to,
java.lang.String message)
to - Receiver phone numbermessage - Text to sendpublic static android.content.Intent showStreetView(float latitude,
float longitude,
java.lang.Float yaw,
java.lang.Integer pitch,
java.lang.Float zoom,
java.lang.Integer mapZoom)
latitude - Latitudelongitude - Longitudeyaw - Panorama center-of-view in degrees clockwise from North.
Note: The two commas after the yaw parameter are required.
They are present for backwards-compatibility reasons.pitch - Panorama center-of-view in degrees from -90 (look straight up) to 90 (look straight down.)zoom - Panorama zoom. 1.0 = normal zoom, 2.0 = zoomed in 2x, 3.0 = zoomed in 4x, and so on.
A zoom of 1.0 is 90 degree horizontal FOV for a nominal landscape mode 4 x 3 aspect ratio display Android
phones in portrait mode will adjust the zoom so that the vertical FOV is approximately the same as the
landscape vertical FOV. This means that the horizontal FOV of an Android phone in portrait mode is much
narrower than in landscape mode. This is done to minimize the fisheye lens effect that would be present
if a 90 degree horizontal FOV was used in portrait mode.mapZoom - The map zoom of the map location associated with this panorama.
This value is passed on to the Maps activity when the Street View "Go to Maps" menu item is chosen.
It corresponds to the zoomLevel parameter in showLocation(float, float, Integer)public static android.content.Intent showLocation(float latitude,
float longitude,
java.lang.Integer zoomLevel)
latitude - Latitudelongitude - LongitudezoomLevel - A zoom level of 1 shows the whole Earth, centered at the given lat,lng.
A zoom level of 2 shows a quarter of the Earth, and so on. The highest zoom level is 23.
A larger zoom level will be clamped to 23.findLocation(String)public static android.content.Intent findLocation(java.lang.String query)
query - Query stringshowLocation(float, float, Integer)public static android.content.Intent showLocationServices()
public static android.content.Intent openLink(java.lang.String url)
url - Target urlpublic static android.content.Intent openLink(java.net.URL url)
openLink(String)public static android.content.Intent openVideo(java.io.File file)
file - File to openpublic static android.content.Intent openVideo(java.lang.String file)
openVideo(java.io.File)public static android.content.Intent openVideo(android.net.Uri uri)
openVideo(java.io.File)public static android.content.Intent openAudio(java.io.File file)
file - File to openpublic static android.content.Intent openAudio(java.lang.String file)
openAudio(java.io.File)public static android.content.Intent openAudio(android.net.Uri uri)
openAudio(java.io.File)public static android.content.Intent openImage(java.lang.String file)
file - File to openpublic static android.content.Intent openImage(java.io.File file)
openImage(String)public static android.content.Intent openImage(android.net.Uri uri)
openImage(String)public static android.content.Intent openText(java.lang.String file)
file - File to openpublic static android.content.Intent openText(java.io.File file)
openText(String)public static android.content.Intent openText(android.net.Uri uri)
openText(String)public static android.content.Intent pickFile()
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Uri file = data.getData();
}
public static android.content.Intent pick(java.lang.String mimeType)
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Uri file = data.getData();
}
mimeType - the type of file to pickpublic static android.content.Intent callPhone(java.lang.String phoneNumber)
<uses-permission android:name="android.permission.CALL_PHONE"/>phoneNumber - Phone numberpublic static android.content.Intent pickContact()
public static android.content.Intent pickContact(java.lang.String scope)
scope - You can restrict selection by passing required content type.public static android.content.Intent pickImage()
public static android.content.Intent dialPhone(java.lang.String phoneNumber)
callPhone(String) applies to dial as well.phoneNumber - Phone numberpublic static boolean isCropAvailable(android.content.Context context)
context - Application contextcropImage(android.content.Context, java.io.File, int, int, int, int, boolean)public static android.content.Intent cropImage(android.content.Context context,
java.io.File image,
int outputX,
int outputY,
int aspectX,
int aspectY,
boolean scale)
isIntentAvailable(android.content.Context, android.content.Intent)
see isCropAvailable(android.content.Context) insteadcontext - Application contextimage - Image that will be used for cropping. This image is not changed during the cropImageoutputX - Output image widthoutputY - Output image heightaspectX - Crop frame aspect XaspectY - Crop frame aspect Yscale - Scale or not cropped image if output image and cropImage frame sizes differsdata-extra in onActivityResult which contains result as a
Bitmap. See demo app for detailspublic static android.content.Intent photoCapture(java.lang.String file)
file - Full path to captured filepublic static boolean isIntentAvailable(android.content.Context context,
android.content.Intent intent)
context - Application contextintent - Checked intent