In the XML layout file, we can set both PX and dp (or DIP ). We usually choose to use DP to ensure the layout of machines with different screen resolutions is consistent. HoweverCodeHow to deal with it? Many control methods only provide the method
CopyCode The Code is as follows: public class personadapter extends
Baseadapter {
Private list persons; // data to be bound
Private int resource; // the ID of the bound entry interface. In this example, It is item. xml.
Private layoutinflater
Recently, the project needs to support emoticon. The addition and resolution of emoticon are basically based on the SmileyParser of Android,Directly paste the Code:
Copy codeThe Code is as follows: public class SmileyParser {
Private static
For details, see http://developer.android.com/tools/debugging/ddms.html. DDMS is a bridge between IDE, emultor, and real android devices. Developers can view the running process/ready-to-use status on the target machine through DDMS. They can go to
1) View switching control-Overview of ViewFlipper
The ViewFilpper class inherits from the ViewAnimator class. The ViewAnimator class inherits from FrameLayout.
View the source code of the ViewAnimator class. We can see that this class is mainly used
Why do we need to add channel information in the application?
The release of Android applications must face various markets, which are called channels. Sometimes, we need to know the channel from which the application is downloaded. For example, we
Very simple, so you can directly look at the code
Copy codeThe Code is as follows: package xxx;
Import android. content. BroadcastReceiver;Import android. content. Context;Import android. content. Intent;Import android.net.
(1) Preface
By default, Android provides the contact backup function to the SD card (the code is in com. android. in the vcard package), we can export the contact. the vcf file is stored in the SD card. If you change your mobile phone, you can
UiScrollable is a UiCollection and provides support for searching for items in a scrollable user interface (UI) elements. This class can be used with horizontally or vertically scrollable controls.
UiScrollable is a UiCollection (this is not
The rule mode is actually very simple (Do you feel relaxed when you hear this sentence ?).For example, the official team will tell you that there is an ISort sort () method for sorting, and then the folks will do their best to achieve this sort
The main purpose is to enable the program to exit when you press the back key.
Implementation ideas:1. The event is triggered when the back key event is captured.
Copy codeThe Code is as follows: @ Override
Public boolean onKeyDown (int keyCode,
Most of the time, the software we develop needs to provide users with the software parameter setting function, such as our commonly used QQ, users can set whether to allow strangers to add themselves as friends. For saving software configuration
Copy codeThe Code is as follows: // echo of the Data list
Public void shujuList (){
List customerList = dao. findALL ();
TableLayout tl = (TableLayout) findViewById (R. id. tlLayout );
Log. I (">>>", String. valueOf (tl. getChildCount ()));
Preface
Content Provider provides a unified interface for data storage and data retrieval. It can share data in different applications, in the previous article about how to use SQLite developed by Android, SQLite can only share data in the same
Copy codeThe Code is as follows:
Linear layout configuration. In this label, all components are lined up from top to bottom.
-->
Xmlns: android = "http://schemas.android.com/apk/res/android"
Android: orientation = "vertical"
Android: layout_width =
Use Activit's openFileOutput () method to save the file, which is placed inside the mobile phone;Note: create an image file for the SDCard in the simulator. You can create an image file in the simulator or install the tools directory in the android
Common data storage and access methods:FileSharedPreferences (preference parameter settings)SQLite DatabaseContent provider)Network
Activity (Context)The Context. getCacheDir () method is used to obtain/data//cache directory.The Context. getFilesDir
Parse XML files:On the Android platform, you can use the pull parser that comes with SAX, DOM, and Android to parse XML files;The pull parser provides various events using parser. the next () method enters the next element and triggers the
If the visitor of ContentProvider needs to know the data changes in ContentProvider, you can call getContentResolver (). policychange (uri, null) When ContentProvider changes data to notify the visitor registered on this URI.
Copy codeThe Code is
Handler definition:It mainly accepts data sent by sub-threads and uses this data with the master thread to update the UI.Explanation: When an application is started, Android will first enable a main thread (that is, the UI thread). The main thread
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service