Recently in the study of Android Development, wrote a flashlight case, share!activity.xmlpackagecom.fq.flashlight;importandroid.app.activity;import Android.app.alertdialog;importandroid.content.dialoginterface;importandroid.hardware.camera;import android.hardware.camera.parameters;importandroid.os.bundle;importandroid.view.view;import android.view.View.OnClickListener;importandroid.widget.Button;importandroid.widget.TextView; publicclasslightactivitye
The n78 flash light is too bright to be turned off. The power off is also bright. It is not bright only when the battery is switched off.
A few days ago, when I got home and took out my cell phone, I couldn't close the flash. This is the second time, because the first repair took nearly a month. I don't want to deliver the repair work this time. I decided to open it and study it myself. By the way, clean up the dust and learn about the internal structure of n78. Remove the screen protection lay
1. In the mobile phone standby state We are on the desktop with the finger down sliding "notice bar" as shown in the following figure.
2. Here we will see many of the system default tools here, and now click the "More" button below.
3. Then enter the system's custom switch settings, such as we will see a "Flashlight" item, and then with the finger belly Press the button to drag up to the 1th to 11th switch between the button to loosen.
Focus:1, Surfaceview, OpenGL ES texture------camera capture image stream texture2, style.xml configuration file. Set up information such as Untitled3. Use framelayout layout,Main.xmlUi_flashlight.xml4, the use of flash.xml file to achieve the gradient effect, and then the use of android:src= "@drawable/flashlight", introduced.Flash.xml5. Function codeFlashlight.javapublicclassmyflashlightextendsmybaseactivity{ @Override protected voidoncreate (bundles
Please follow the instructions described below:
1. In standby mode, click "Application".
2. Click on the "Panel" above the screen.
3. After entering the group, slide the screen to the left with your finger, find the "auxiliary light", and then click on the "Auxiliary light" and drop it onto the page. Then you click on the auxiliary light on the page, when the light on the back of the phone emits a strong light.
After the above operation is set up, your mobile phone can be used as a
Today look at their own before the scanning, found that the lighting is not very clear, here to write again, also do the collection#import -(void) lightswitch:ison{Avcapturedevice *capturedevice = [Avcapturedevice defaultdevicewithmediatype:avmediatypevideo]; Create a video-type drive object to start the flashlightif (![ Capturedevice Hastorch]) return; Detects if there is a lightif (![Capturedevice Hasflash]) return; Detects if there is a light[Capturedevice Lockforconfiguration:nil];The offici
A few days ago this side of a community power, black Ma Ma, a cat broke into the dormitory, frighten me into tears, and then decisively wrote a flashlight, the next power outage, again, I want to frighten it.
I saw a lot of people are directly call the flash, in fact, most of the models are not supported, I this is to use the camera function to achieve, most of the models are supported.
Mainactivity.class
public class Mainactivity extends fragm
Ihardwareservice
{
Obsolete Flashlight Support
Boolean getflashlightenabled ();
void Setflashlightenabled (Boolean on);
}
and then introduce it into your program.
Copy Code code as follows:
Import Android.os.IHardwareService;
/**
* Set up and close the flash
* @param isenable
* @author Linc
* @date 2012-3-18
*/
private void Setflashlightenabled (Boolean isenable)
{
Try
{
Method method = Class.forName ("Androi
On the basis of the previousUnder the Res folder: Add a Drawable/local_me.xmlLocalme_cml Main program:Package Com.example.handlightactivity;import android.app.Activity; Import Android.hardware.Camera; Import Android.hardware.Camera.Parameters;
I encountered a headache when I was learning Android-how to make the text work out as a drive lamp. At first I wanted to find some information on the Internet, just like everyone else, however, after searching for a few hours on the Internet, I
Tip: you can modify some code before running Flashlight lighting effect之间-->I miss you one day after another,I still haven't changed,When can a beautiful dream appear,Dear, I really want to see you again.The autumn wind blew through,Remembering this
The main implementation of two steps:
1, the realization turns on and closes the flash lamp, but realizes the operation Flash mainly through camera class
Camera Camera = Camera.open ();
Parameters mparameters = Camera.getparameters ();
On the Standby page, click "Application".
2. Click on the "Panel" at the top of the screen.
3. Slide the phone screen with your finger to find the "auxiliary light" panel.
4. Click on the "auxiliary light" group pieces do not let go, drag
1. Set the layout file as follows:
2. Use getWindow (). setBackgroundDrawable to set the global color for key java code settings
public void clickRed(View view) {getWindow().setBackgroundDrawable(new ColorDrawable(Color.RED));}public void
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.