Bluetooth search for andriod Bluetooth Development
Bluetooth search is implemented through broadcast. The key code is as follows:
1. Used to discover broadcast recipients of Bluetooth
/*** Receiver * called when bluetooth device search is complete */private BroadcastReceiver _ foundReceiver = new BroadcastReceiver () {public void onReceive (Context context, Intent intent) {effecthdevice device = intent. getParcelableExtra (effecthdevice. EXTRA_DEVICE
1. Have done Java before, so look at the code is still very kind ...2. A few points to note about using the Fragment wrapper control:
Activity implements the fragment interface for data exchange between activity and fragment. Otherwise, the type conversion exception is reported.
Add event listeners for fragment child controls in the Onactivitycreated life cycle method of fragment.
The id attribute must be added to fragment when adding fragment statically.
About the fragment versio
. Porting Linux Drivers is a very important one. is to modify the Linux driver source code, you should try not to modify the Linux driver interface. This chapter focuses on LED drivers, a Linux driver that really deals with hardware. Although the LED driver is not complicated, it only controls a few LEDs, but the LED driver already includes all the necessary parts of the Linux drive. A complete Linux driver consists of two parts: internal processing and hardware interaction. The internal process
value for console log level.Prevent PRINTK functions from reducing Linux drive performanceThe PRINTK function displays messages in the console through the/dev/console device file. The device file only works under the console of the character interface, so the PRINTK function is only used on the console of the character interface to output messages normally.If you do not want to use the PRINTK output message, simply change the 1 in #if1 to 0.Data interaction through a virtual file system (/PROC)
Andriod Small Item--online music playerAndroid online music playerSince freshman year has started to self-study Java and Android , it has been almost one years. Finally to begin to do the project in the stage of actual combat. First DIY online music player. The following features are implemented:This player can asynchronously read and parse JSON data from a simple server built on a native computer , play Music , switch music , display time , and Sh
.e.g.1) Declare a a tag:1 2) Initialize the A-tag tap event:1 $ ("#photo"). Live ("tap", Getphoto);3) Tap event:1 functionGetphoto () {3 if(!Navigator.camera) {4Alert ("Camera can not use");5 return;6 }7Navigator.camera.getPicture (onsuccess, Onfail, {quality:50, DestinationType:Camera.DestinationType.FILE_URI});8 9 functiononsuccess (imageData) {Ten //alert ("Camer successful!!!"); One //alert (imageData); A varnewnote=$ ("#newNote"); - varSrc
1. Use menu in activity//Create menu itemPublic BooleanOncreateoptionsmenu (Menu menu) {//inflate the menu; This adds items to the action bar if it is present.getmenuinflater (). Inflate (R.menu.main, menu); return true; }//Click on one of the menus to trigger the event @Override Public Booleanonoptionsitemselected (MenuItem item) {//Handle Action Bar item clicks here. The Action Bar would//automatically handle clicks on the Home/up button, so long//As you specify a the parent activity in Androi
This chapter introduces the main work of Android system porting by introducing Android system architecture----see the definition rules for Linux kernel version->linux kernel version number, how to learn Linux driver development->linux device driver A basic overview of the Andriod system porting and driving development is given in the form of Linux driver examples.First of all, Android transplant can be divided into: application porting and system port
parameters
doinbackground (Params ...) , invoked on the background thread immediately afteronpreexecute () finishes executing. This step was used to perform background computation the can take a long time. The parameters of the asynchronous task is passed to this step. The result of the computation must is returned by this step and would be passed the last step. This step can also Usepublishprogress (Progress ...) to publish one or more units of progress. These values is published on the U
() >0) {//query set greater than 07ListNewArraylist//Create a collection personlist8 while(Cursor.movetonext ()) {//table cursor moves from top to bottom9 intID =cursor.getint (0);//take the No. 0 column---IDTenString name = cursor.getstring (1);//take the 1th column---name One intAge = Cursor.getint (2);//take the 2nd column--- age APersonlist.add (NewPerson (id,name,age));//load the acquired data into the collection Personlist - } - db.close (); the returnPersonlist;//return this collection
-generated Method Stub}});}private void init () {TODO auto-generated Method Stub//Get down the Marquee objectSpyear = (Spinner) Findviewbyid (r.id.spyears);//Get Adapter ObjectThe first parameter is the activity object where the layout is to be displayed, the second parameter is the physical address of the collection data to be displayed, and the third parameter isrefers to the appropriate layout page, where Android comes directly with the layoutArrayadapter = Arrayadapter.createfromresource (th
(New Onclicklistener () {@Overridepublic void OnClick (View arg0) {TODO auto-generated Method StubEditText Txtedittext = (EditText) Findviewbyid (r.id.txtwrite);String string = Txtedittext.gettext (). toString ();Mode_private and incoming 0 are the same, indicating that only the current application can operate on this sharedpreferences fileSharedpreferences.editor Editor = getsharedpreferences ("Data", Mode_private). Edit ();Editor.putstring ("name", string);Editor.commit ();}});Button Btnread
6. Configuration class:The configuration class is specifically designed to describe configurations on mobile devices, which include both user-specific configuration items and dynamic device configurations for the system.The program can invoke the following method of activity to obtain the system's configuration object:Configuration cfg = getresources (). GetConfiguration ();After that, you can call the properties of the configuration object to get the device state .
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.