Android interview collect phone calls, text messages and contacts, multimedia technology

Source: Internet
Author: User

1. Please write out the calling system dial-up interface?
    • Intent intent=new Intent (intent.action_dial,uri.pase ("tel:12345678910"));
    • StartActivity (Intent);
    • Add Permission: <uses-permission android:name= "Android.permission.CALL_PHONE" >

2. How many ways are there to listen for incoming calls in the Android system?
    • Method 1: Broadcast receivers
    • French 2:telephonemanager objects

3. Please give the content Provider URI of the access call log?
    • Uri.parse ("Content://call_log/calls")

4. How to call system SMS?
    • Intent sendintent=new Intent (Intent.action_sendto,uri.parse ("sms:12345678900"));
    • Sendintent.putextra ("Sms_body", "How are you?" ");
    • StartActivity (sendintent);

5. Please write the code that sends text messages directly from the Android system?
    • Smsmanager Smsmanager=smsmanager.getdefault ();
    • Smsmanager.sendtextmessage ("12345678900", NULL, "How are You?") ", null,null);
    • Then configure the permissions: <uses-permission android:name= "Android.permission.SEND_SMS"/>

6. Please write out what is the content Provider URI that accesses MMS data?
    • Content://mms

7. Write out the content Provider URI of the access system contact and the permissions you need to set?
    • Contractscontract.authority_uri
    • Need to be set in the manifest file: <uses-permission android:name= "Android.permission.READ_CONTACTS" >

8. How do I play audio from the Res/raw directory?
    • MediaPlayer mediaplayer=mediaplayer.create (This,r.raw.music);
    • if (mediaplayer!=null) mediaplayer.stop ();
    • Mediaplayer.prepare ();
    • Mediaplayer.start ()

9. How to record?
    • Mediarecorder mediarecorder=new Mediarecorder ();
    • Mediarecorder.setaudiosource (MediaRecorder.AudioSource.MIC); Specify the audio source
    • Mediarecorder.setoutputformat (MediaRecorder.OutputFormat.MPEG_4); Specify the audio output format
    • Mediarecorder.setaudioencoder (MediaRecorder.AudioEncoder.DEFAULT); Specify how audio is encoded
    • Mediarecorder.setoutputfile (Recordaudiofile.getabsolutepath ()); Specify Playback file
    • Mediarecorder.prepare ();
    • Mediarecorder.start ();

How do the 10.Android SDK support the different ways to play video?
    • FA 1:videoview
    • FA 2:surfaceview+mediaplayer

11. How do I play the video?
    • Videoview.setvideouri (Uri.parse ("file:///sdcard/video.3gp")); Specify the video file to play
    • Videoview.setmediacontroller (New Mediacontroller (this)); Setting up a video player
    • Videoview.start ();

12. How do I use Surfaceview to play videos?
    • Mediaplayer=new MediaPlayer ();
    • Mediaplayer.setaudiostreamtype (Audiomanager.stream_music);
    • Mediaplayer.setdisplay (Surfaceview control)
    • Mediaplayer.setdatasource ("File path");
    • Mediaplayer.prepare ();
    • Mediaplayer.start ();

What is the difference between 13.SurfaceView and videoview?
    • Surfaceview+mediaplayer can control the location and size of playback

14. How do I call the system to take pictures?
    • Intent intent=new Intent (mediastore.action_image_capture);
    • Startactivityforresult (intent,1);

15. How do I customize the camera function?
    • Control the camera in your phone with the Android.hardware.Camera class

16. How do I set up a call tone?
    • Implemented through intent
    • New Intent (Ringtonemanager.action_ringtone_picker);
    • Intent.putextra (Ringtonemanager.extra_ringtone_type,ringtonmanager.type_ringtone);
    • Intent.putextra (Ringtonemanager.extra_ringtone_title, "set caller ringtone");
    • Startactivityforresult (intent,1);

Android interview collect phone calls, text messages and contacts, multimedia technology

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.