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
In application DetectionProgramWhen upgrading, you must first obtain the version number and compare it with the server to determine whether to upgrade.
Android has two version numbers: versioncode, versionname, and versionname)
The specific
Before using sqlite3, I did not notice the sqliteopenhelper class, so I had to create and maintain databases and data tables in the activity.
However, with the sqliteopenhelper class, you can separate the maintenance of databases, data tables,
Sometimes we may need to combine the two images to make them a synthetic image. below is my documents for future review.
Public bitmap diejia (Bitmap B ){ If (! B. ismutable ()){ // Set the image to transparent as the background B = B. Copy
Let's talk about the principle. As you know, android can monitor databases. However, I personally feel that this monitoring is not powerful. No matter how the monitoring is implemented, the final result returned is whether the database has changed
In Android, scheduled operations rely on the alarmmanager class to complete this function.
:
The following is an example:
Datesetactivity:
package com.hello.project;import java.util.Calendar;import android.app.Activity;import
I recently used gravity sensing in Android in my project. I will share it with you.
The gravity sensor coordinate is relative to the device, not the spatial coordinate,
The Code is as follows;
Package COM. pioneersoft. temp; import android. app.
In Android, many permissions are defined for some system-related operations, such as phone calls, text messages, and file writing, to ensure security. To ensure application security and stability, we can customize some permission mechanisms to
When the Android system is started, the system automatically scans the files in the sdcard and stores the obtained information in a system database. The program wants to access the system file information, instead of directly retrieving data from
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
Obtain the height of the status bar and title bar.Retrieve the status bar height:The getwindowvisibledisplayframe method can obtain the display area of the program, including the title bar, but not the status bar.So we can calculate the height of
Recently, you need to specify the size and location of the imageview in the code when you are working on a project. After a day of research, you can finally share it with us.Hope to help you
The following uses imagview as an example:// Obtain
To sum up the adaptability of Android development, we recommend that you use screen density dip for the control spacing and size to avoid too many differences.
Method for obtaining screen density;
Displaymetrics dm = new displaymetrics ();Dm =
There are two ways to handle dialog box events:
There are two methods for event listening in the dialog box:
1. Listen to the dialog event;
To listen to the back key event, you only need to implement the dialoginterface. onkeylistener interface.
The
Hide the title bar and hide the status bar Android: theme = "@ Android: style/theme. notitlebar. fullscreen"Android: theme = "@ Android: style/theme. translucent"Android: theme = "@ Android: style/theme. Dialog"
// Initialize the screen
Use broadcast intent to control the built-in music player in Android
Zhengzhiren
Http://blog.csdn.net/ZhengZhiRen/archive/2011/01/13/6134730.aspx
The music player that comes with Android can only be regarded as an application on the system and
People who use the launcher of ADW should be somewhat impressed with the function, that is, to drag the application or widget icon to the delete icon and stay for more than 1 second,
The "drop to uninstall" prompt is displayed. If you open it, open
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