Android calls system features

Source: Internet
Author: User

Camera

A. call the system camera directly

Intent Intent = new Intent (); // call camera

Intent.setaction ("Android.media.action.STILL_IMAGE_CAMERA");

StartActivity (Intent);

You do not need to set permissions.

B. the camera you wrote yourself

1 Display the preview effect in the camera- -surfaceview

Camera ———— >surfaceholder ———— >surfaceview

Setpreviewdisplay (Holder) Getholder ()

Startpreview () and Stoppreview () to turn preview on and off .

2 turning on the camera:camera.open ()

* * This method, can not be placed casually, such as in the construction method or onCreate () method, will be photographed without preview effect .

Make a phone call

1 calling up the dial screen

Intent dial=new Intent ("Android.intent.action.CALL_BUTTON");

Intent dial=new Intent (Intent.action_call_button);

2 call directly

Call Permissions:

Android.permission.CALL_PHONE incoming phone number direct dialing

Android.permission.CALL_PRIVILEGED incoming phone number to dialer, requires user confirmation to dial

Intent Intent = new Intent (Intent.action_dial,uri.parse ("tel:13655345433"));
Intent.setflags (Intent.flag_activity_new_task);  

Mobile Desktop

1 setting up the desktop

SetWallpaper (InputStream data)

As the desktop background map must be the same as the aspect ratio of the screen (resolution is not necessarily the same)

Because the mobile phone desktop is not sure to put on that phone, in the screen resolution is unknown, maintain the aspect ratio, do not deform.

2 Getting the phone desktop

Getwallpaper () When the phone does not have a desktop, return to the system default

Peekwallpaper () returns NULL when the phone does not have a desktop

3 Restoring the system default desktop

Clearwallpaper ()

For desktop operation, increase manifest permissions: Android.permission.SET_WALLPAPER

Android calls system features

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.