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