Android Platform Flashlight Development source code, Androidmanifest.xml file of the entrance is Startapp, this file is not uploaded up, everyone can write their own. 1. [Code]androidjquery Effects/** * Name: Flashlight Main Interface * Author: [email protected] * date:2012-12-21 15:50:17 */package Com.android.app; Import Android.app.activity;import Android.hardware.camera;import Android.hardware.camera.parameters;import Android.os.bundle;import Android.view.view;import Android.widget.textview;import android.widget.Toast; public class Main extends Activity {Private Boolean isopent = false;private camera camera; @Overrideprotected void OnCreate (Bundle savedinstancestate) {//TODO auto-generated method stubsuper.oncreate (savedinstancestate);View view = View.inflate (this, r.layout.main, null);Setcontentview (view);TextView img_but = (TextView) Findviewbyid (r.id.main_img);Img_but.setonclicklistener (New View.onclicklistener () {@OverridePublic void OnClick (View v) {//TODO auto-generated method stubif (!isopent) {Toast.maketext (Getapplicationcontext (), "You have turned on the flashlight", 0). Show (); http://www.huiyi8.com/webyuanma/camera = Camera.open ();Parameters params = Camera.getparameters ();Params.setflashmode (parameters.flash_mode_torch);camera.setparameters (params);Camera.startpreview ();//Start lightisopent = true;} else {Toast.maketext (Getapplicationcontext (), "Turn off the flashlight",toast.length_short). Show ();Camera.stoppreview ();//Turn Off the lightscamera.release ();//Turn off the cameraisopent = false; } } }); } }2. [Code] Layout file code <?xml version= "1.0" encoding= "Utf-8"? ><linearlayout xmlns:android= "/http/ Schemas.android.com/apk/res/android " android:layout_width=" match_parent " Android:layout_ height= "Match_parent" android:orientation= "vertical" > <TextView & nbsp android:id= "@+id/main_img" android:layout_width= "fill_parent" & nbsp android:layout_height= "Fill_parent" android:background= "@drawable/main_body" > </textview> </linearlayout>3. Code Androidmanifest.xml file <manifest xmlns:android= "Http://schemas.android.com/apk/res/android" package= "Com.android.app" android:versioncode= "1" android:versionname= "1.0" > <uses-sdk android:minsdkversion= "8" android:targetsdkversion= "/> <application android:icon=" @ Drawable/ic_launcher " android:label=" @string/app_name " Android: Theme= "@style/apptheme" > <activity android:name= ". AppStart > <intent-filter> &NB Sp <action android:name= "Android.intent.action.MAIN"/> <category android:name= "Android.intent.category.LAUNCHER"/> < /intent-filter> </activity> <activity android:name= ". Main "> </activity> </application> <!--camera, flashlight-- > <uses-permission android:name= "Android.permission.CAMERA"/> <uses-permission android:name= "Android.permission.FLASHLIGHT"/> < Uses-feature android:name= "Android.hardware.camera"/> <uses-feature android:name= " Android.hardware.camera.autofocus "/> <uses-feature android:name=" Android.hardware.camera.flash "/> </manifest>