Search for a specified file:
Public String searchfile (string filename) {string res = ""; file [] files = new file ("/sdcard "). listfiles (); For (file F: Files) {If (F. isdirectory () searchfile (F. getname (); elseif (F. getname (). indexof
Sometimes you need to click the edittext pop-up dialog and other operations. The advantage of textview is that you do not need to control the background status.
Final inputmethodmanager Imm = (inputmethodmanager) mcontext. getsystemservice
I need to display a loading recently. I suddenly don't know whether to use progressbar or progressdialog? Blinded.
Progressdialog, since it is a dialog, it must be a pop-up window, a dialog. Progressbar, which must be a bar, is. This analysis is
InProgramWhen adding a background, I find that the list or grid list is dark and ugly. I think Android certainly provides a method that is not always dark or transparent when users drag the list.
Actually, it is only the view attribute. Both
There are four types of Android:
Alpha_8: each pixel occupies 1 byte of memory
Argb_4444: each pixel occupies 2 bytes of memory
Argb_8888: each pixel occupies 4 bytes of memory
Rgb_565: each pixel occupies 2 bytes of memory
The default
Sometimes you need to set the view, especially the height of the "dynamic" Custom view.
For example, in XML, we cannot determine the height of the view, which is related to the actual situation of the mobile phone.
Then we mustCode.
The
The first method is relatively simple and common ~ Because I have developed such things:CodeAs follows;
Public class actjava extends activity {Public void oncreate (bundle savedinstancestate ){
Super oncreate (savedinstancestate );Setcontentview
I recently studied several startup modes of activity, which are summarized as follows:
The four startup modes are as follows:
"Standard" (default)
"Singletop"
"Singletask"
"Singleinstance"
Standard is created every time, and each
I wrote a custom view, which uses handler for a loop. in the loop process, how can I click the Left or Right key to make a response?The result I want is: Print begin and handler cyclically. When the left and right keys are pressed, print: left and
When developing applications such as short messages and app stores, we will consider adding the number of unread text messages to the icon of the short message, and adding the number of apps that can be upgraded to the app store, in this way, the
Recently, I have been exposed to some processing pages with a large amount of data, so it is inevitable to use the asynchronous loading method.
Summary:
1. Handle + thread is the most popular method;
2. Use asynctask
3. activity. runonuithread
What's G-sensor?
An G-sensor (or accelerometer) is a device that measures proper acceleration, the acceleration experienced relative to freefall.
Single-and multi-axis models are available to detect magnfunctions and ction of the acceleration as a
In Android, images in GIF format cannot be directly loaded, but can only be implemented through the auxiliary class movie. The specific method is as follows;
public class DrawMusicNote extends View {private Movie mMovie;private long
Service is the most similar component to activity among the four Android components. It can represent executable programs.
The difference between service and activity is:(1) The Service has been running in the background and there is no user
Principle: Get the content of the incoming call message and call the system's speech reading function.
:
The Code is as follows:
1. Get short messages:
Package COM. internal. message; import android. content. broadcastreceiver; import android.
I have always used the program package name and Icon recently. The following is a summary:
Packageinfo Info; try {info = This. getpackagemanager (). getpackageinfo (this. getpackagename (), 0); // name of the current application version string
Softreference in JavaSoft reference of an object. If an object has soft references and the memory space is sufficient, the recycle bin will not recycle it. If the memory space is insufficient, the memory of these objects will be recycled. The object
The server is down. Maybe this will solve my problem.
This section writes a small program and has a certain interface that needs to edit a lot of data. Therefore, a listview is used to put edittext in it for editing controls. The following
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