Alibabacloud.com offers a wide variety of articles about android getapplicationcontext, easily find your android getapplicationcontext information here online.
Android development-Tomast and androidtomast
The first time I published an article in the blog, I will share with you the prompt settings I just learned about Android development.
Tomast is a frequently used method in Android. It is used for simple user prompts. After exploring it, I found two ways to use Tomast. I will share it with you.
The first default method
Android Android-android Application Structure Analysis (4), android Application Development
Description of the automatically generated R. java File
1 public final class R { 2 public static final class attr { 3 } 4 public static final class dimen { 5 /** Default screen margins, per the
1. the lifecycle of the Activity is different from that of the Dialog AlertDialog. Builder builder = new AlertDialog. Builder (context );
2. The context is the context of the Activity. 3. The Dialog must be dismiss () before the Activity is destroyed. Otherwise, the form overflows.
In android, content related to context is often encountered. In this blog, we will discuss context: in the AlertDialog statement. builder builder = new AlertDialog. in Bu
= keyCode ){7576 Toast. makeText (getApplicationContext (), "I am the Home Key ",77 Toast. LENGTH_SHORT). show ();7879 return true;8081}8283 /*84 * click the menu key85 */86 if (KeyEvent. KEYCODE_MENU = keyCode ){8788 Toast. makeText (getApplicationContext (), "I am the Menu key ",89 Toast. LENGTH_SHORT). show ();9091 return true;9293}9495 /*96 * determine whether the key clicked is the search key97 */98 i
Service is one of the four main components of Android, previously on the service life cycle, as well as examples of the life cycle of unbound types, this time to share the binding form.The application component (client) can call Bindservice () to bind to a service. The Android system then calls the service's Onbind () method, which returns a ibinder that is used to interact with the service.The binding is a
specify the file name (if it does not exist, it is automatically created without a suffix, and the system automatically adds it), and the second parameter specifies the file operation mode, there are two main modes: MODE_PRIVATE and MODE_MULTI_PROCESS. MODE_PRIVATE has the same effect as directly passing in 0, indicating that only the current application can read and write the SharedPreferences file; MODE_MULTI_PROCESS is generally used when multiple processes read and write the same SharedPref
Use of Android Common instance-alert dialog
The use of Alertdialog is common, and in applications where you want users to make "yes" or "no" or a variety of other choices, you can use Alertdialog to maintain the same activity and not change the user's screen.
This article mainly explains how to achieve a variety of alertdialog, the article is longer, if you can read it carefully, the various usages of alertdialog should be able to grasp,
Android Development Series (7): stores files in SDCard, androidsdcard
Generally, the default storage space of our mobile app is in the memory of the mobile phone, but for large files such as video and audio, we can store it in SDCard:
The following code stores the file in SDCard (only core code is implemented)
First, we need to provide the SDCard permission to store the data in SDCard:
Add permissions to AndroidManifest. xml:
Then, add a method in
The Toast in Android is a simple message prompt box. The toast prompt box cannot be clicked by users. The toast will automatically disappear after the display time you set. I. display the default Toast implementation code: 1Toast. makeText (getApplicationContext (), "display default Toast", Toast. LENGTH_LONG ). show (); there are two ways to create the default Toast. Let's take a look at the following: 1.
Now there's an Android project A. We wanted to extend the functionality of a, but didn't want to develop on a basis, so we created another Android project B and wanted to refer to a in B.
One idea is to make engineering a a pure jar bag so that other projects can be referenced directly.
However, if you use a reference in R.java in Project A, you cannot make a jar package. The reason is that R.java are gen
Everyone android is a good mobile phone application software, we use the time to find his home page layout is nine mode, people feel very chic, because now a lot of Android software rarely use this layout mode, everyone Android use is very successful, Make people feel simple and generous and beautiful, let's look at the layout of
Objective
Since most of the Android beginner's tutorial doesn't teach you how to choose time, beginners encounter this kind of inevitable will be a bit overwhelmed, should let the user enter the date time? Not to say that the user experience is not good, processing users to enter a variety of date format will also take a great deal of effort, below to see how to achieve the Android selection time function.
Android Studio is a Google Android development environment, similar to eclipse development and debugging, is a tool development software. Android Studio 1.0 has recently been released. For more information, view the page.
Install using the PPA, very convenient, open the terminal, enter the following command:
sudo add-apt-repository ppa:paolorotolo/
The generated Android application APK file is best optimized because the essence of the APK package is a zip-compressed document that optimizes the orderly arrangement of uncompressed data in the package, reducing the memory consumption at the time the application runs. We can use the Zipalign tool for APK optimization.
Zipalign is an important tool for optimizing APK applications, according to the Android
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.