A small demo about a custom control that moves with the fingers of the ball.First look at the effect of the picture:
The implementation code is as follows:
1. Custom Control class
Package Com.dc.customview.view;
Import
1. Set the color of the control in code:
Copy Code code as follows:
int b = getresources (). GetColor (R.drawable.blue);//Get the color in the configuration file
Mbutton.settextcolor (b);
2. Set the font of space:
Mode one:
Error log: Error:java.lang.RuntimeException:Some file crunching failed, logs for details
Log:
Failure:build failed with a exception.
* What went wrong:Execution failed for task ': App:mergedebugresources '.>
We all know that the activity of Android is stored in the history stack, such as from A-> b-> C, C finished finish after the return to B, all the activity is finish, the program will naturally quit. Of course, in the finish of the same time also
Copy Code code as follows:
/**
* Get and save screenshots of the current screen
*/
private void Getandsavecurrentimage ()
{
1. Building Bitmap
WindowManager WindowManager = Getwindowmanager ();
Display display =
There are two ways to share third parties:
1. The need to integrate the official SDK package, the official authorization after the call of its API to complete the share of micro-trust, microblogging and so on.Benefits: Seamless integration,
Custom View,
1. Customize a runnable thread toucheventcountthread to count the number of clicks within 500ms
2. Call the above thread in the ontouchevent in MyView
3. Customize a handler, in the Toucheventhandler processing statistics to the
This article combines the dynamic creation fragment to carry on a practice, realizes uses the fragment to create a tab
Project layout
Create a new Fragment1.java~fragment4.java, where the code in Fragment1.java is as follows:
Today to explain the fragment control, mainly switch view and page replacement operations. There is also how to get the fragment management objects and how to communicate with the activity.1, management FragmentTo manage fragment in an activity, you
The first is to obtain the installation state of the application by broadcasting the formThe following is an application-related broadcast Action
action_package_addedA new application package is already installed on the device and the data includes
Copy Code code as follows:
public class Readbitmap {
public void ReadByte (context C, String name, int indexint) {
Byte[] B = null;
int[] Intarrat = C.getresources (). Getintarray (Indexint);
try {
Assetmanager am = null;
am =
For example, above or below the screen. To achieve this effect. You need to get the Window object for the dialog box, there are several ways to get the Window object. The easiest thing to do is to get the window object directly through the
Everyone who uses Android's native UI knows that Android's activity jump is a very stiff switch interface. In fact, Android's activity jumps can be set up in various animations. Here's a look at the effect:
Implementation is very simple, with
Attention:Intent.setdataandtype (uri.fromfile (file), "Application/vnd.android.package-archive"); In this sentence, the first parameter is the path to the APK to install. The second parameter is the type corresponding to the APK. Can be found in the
Objective
It is well known that ScrollView is a UI control that we often use, and you may find in the process of using scrollview that you do not have the right listener when you want to monitor the distance ScrollView sliding! Of course, there are
Without special requirements, we can use the framework provided by Android to create the system-style preference screen, which can contain preferencecategory and preference Any combination of elements. To create preference screen, you need to add
Definition of HandlerPrimarily accepts data sent by child threads and uses this data to update the UI with the main thread.Explanation: When an application starts, Android first opens a main thread (that is, the UI thread), and the main thread is
Service is neither a process nor a thread, and the relationship between them is as follows:
As you can see, their thread IDs are exactly the same, which confirms that the service is actually running in the mainline Chengri, which means that if
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