Android style and theme)
In Android, a topic is used to define the display style for an application. Its definition is the same as that for a style, as shown below:
<? Xmlversion = "1.0" encoding = "UTF-8"?>
<Resources>
<Stylename = "itcasttheme">
<Item name = "Android: windownotitle"> true </item> <! -No title.
<Item name = "Android: windowfullscreen">? Android: windownotitle </item> <! -Full Screen Display (à)
</Style>
</Resources>
Above "? The question mark in Android: windownotitle is used to reference the resource value defined in the current topic. The following code shows how to set the topic defined above in androidmanifest. xml:
<Applicationandroid: icon = "@ drawable/icon" Android: Label = "@ string/app_name"
Android: theme = "@ style/itcasttheme">
......
</Application>
In addition to setting a topic in androidmanifest. XML, you can also set a topic in the Code as follows:
Settheme (R. style.Itcasttheme );
Camera = camera.Open();
Windowmanager WM = (windowmanager) getsystemservice (context.Window_service);
DisplayDisplay= WM. getdefaultdisplay ();
Camera. parametersparameters = camera. getparameters ();
Parameters. setpreviewsize (320,240); // you can specify the preview size.
// Parameters. setpreviewframerate (3); // three frames per second
Parameters. setpictureformat (pixelformat.JPEG); // Set the photo output format
Parameters. Set ("Jpeg-quality", 85); // photo quality
Parameters. setpicturesize (320,240); // you can specify the Photo size.
Camera. setparameters (parameters );
Camera. setpreviewdisplay (surfaceview. getholder (); // you can use surfaceview to view the video.
Camera. startpreview (); // start previewing
Camera. autofocus (null); // auto focus
Photo response
Private final classTakepicturecallback
ImplementsPicturecallback {
@ Override
Public voidOnpicturetaken (Byte[] Data, camera ){
Try{
Bitmap bitmap = bitmapfactory.Decodebytearray(Data, 0, Data. Length );
File file =NewFile (environment.Getexternalstoragedirectory(), System.Currenttimemillis() + ". Jpg ");
Fileoutputstream outstream =NewFileoutputstream (File );
Bitmap. Compress (compressformat.JPEG, 100, outstream );
Outstream. Close ();
Camera. stoppreview ();
Camera. startpreview (); // start previewing
}Catch(Exception e ){
Log.E(Tag, E. tostring ());
}
}
}