Parsing of Android applications

Source: Internet
Author: User

One: File Schema

Two: Pictures, use of voice resources

two ways to use a picture:

First: Using the ImageView control

     <imageview        android:id= "@+id/imageview1"        android:layout_width= "wrap_content"        android:layout_ height= "Wrap_content"        android:src= "@drawable/logo"/>

The second type: using the ImageView control

public class Mainactivity extends activity {    /** called when the activity is first created. */    @Override    publi c void OnCreate (Bundle savedinstancestate) {        super.oncreate (savedinstancestate);        Create ImageView object        ImageView IV = new ImageView (this);        Set for ImageView, set the picture to Object        Iv.setimagebitmap (Bitmapfactory.decoderesource (Getresources (        ), R.drawable.logo));        Place our ImageView object in the current view        This.setcontentview (iv);                Layout manager        //setcontentview (R.layout.main) that does not use the load XML;}    }

  How to use voice: using the MediaPlayer class

public void OnCreate (Bundle savedinstancestate) {        super.oncreate (savedinstancestate);                        Set our sound resource file to the MediaPlayer object        mmdeiaplayer = Mediaplayer.create (this, r.raw.midi);                Setcontentview (r.layout.main);      Run the MediaPlayer up. Start ();        Mmdeiaplayer.start ();        If we want to stop the sound, we make. Stop ();    

  

Three: Androidmanifest.xml Add app Permissions

<application        android:icon= "@drawable/ic_launcher"        android:label= "@string/app_name" >        < Activity            android:name= ". Mainactivity"            android:label= "@string/app_name" >            <intent-filter>                <action android:name= "Android.intent.action.MAIN"/>                <category android:name= " Android.intent.category.LAUNCHER "/>            </intent-filter>            <uses-permission  Android:name= "Android.permission.SEND_SMS"/>        </activity>    </application>  <uses-permission  android:name= "Android.permission.SEND_SMS"/></manifest>

  

Parsing of Android applications

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.