In Android applications, we often need to record some user-defined preference parameters. In this case, we need to use SharedPreferences and Editor to save the information and read it at next login.
SharedPreferences stores data similar to the configuration information format, so it stores the data in the form of a key-value pair. Let's take a look at the instance code.
The first is the interface layout, wh
Recent projects in the Android project, some of which involve image processing. Here's how to call the camera app to take a picture, and save the difficulties and workarounds that appear in the ImageView control as well.PS: The author purchased the first line of Android code: Guo Lin, referring to the contents of the c
This example describes the Android Desktop plugin app widget usage. Share to everyone for your reference, specific as follows:
application window Widget App Widgets
The application window widget (widget) is a tiny application view that can be embedded in other applications (such as the desktop) and receive periodic updates. You can use an
manner
Uninstall the app and delete only the data you stored ingetExternalFilesDir()目录下的文件
外部存储适用于不需要存储限制的文件以及你想要与其他app共享的文件或者是允许用户用电脑访问的文件 app默认安装在内部存储中,通过指定android:installLocation 属性值可以让app安装在外部存储中。 获取外部存储权限: Read and write: ... > android:name= "Android.permission.WRITE_EXTERNAL_STORAGE"/> ...
in the values/directory describe multiple resources. For a file in this directory, each child of the element defines a single resource. For example, the A element creates an R.string resource and a element creates an R.color resource.Because each resource are defined with their own XML element, you can name the file whatever you want and place different res Ource types in one file. However, for clarity, your might want to place unique resource types in different files. For example, here is s
, on the menu bar, choose Android Studio > Preferences .
2. Navigate to build,execution,deployment > Compiler.3. In the text input box next to command-line options, enter your command-line options.4. Click OK to save and exit.Gradle will try these commands the next time you try to build your app.Generate APKs (Generate APKs)When you click Run , Android Studi
your app here.Finally, you must tell Google that your application complies with their terms and compliance with U.S. export laws. It doesn't matter, as long as your app is on the market, it has to comply with U.S. export laws.6th step: Activate APKPlease switch to the "APK Files" tab and click on the Save button (in the top right corner). Make sure that at least
directory is for app private or other apps to read and write.Example: Context.getdir ("Dir1", mode_private): /data/data/com.srain.cube.sample/app_dir15. Pay special attention to external storage, access to $cacheDir or $filesDir and below the pathUnder API Level 8, or if there is not enough space, the associated method will need to be constructed when the path is empty.@TargetApi (version_codes. FROYO) Public StaticFile Getexternalcachedir
sensitive to case sensitivity. So developers should be aware of the naming changes when using Sugarorm. You write a property name in the Bean, and the field name in the database is not. Of course, this can be done by @column annotations .The second problem is a habitual one. In development due to the need not to directly manipulate sqlitedatabase this type of class, so many people at the same time when the development of a person to commit the code only modified the corresponding bean structure
Android log printing LogUtils can locate the class name, method name, and number of lines with errors, and save log files.
During development, we often use the log printing method to debug our applications. In Java, we often use the System. out. println () method to print logs on the console for debugging. Android has a dedicated Log class to print logs in the
Speaking of Android phone, most people's impression is a bit of time to become a little lag, some programs in the run inexplicably crashes, open the System folder A look, found a lot of files, and then use the mobile phone butler APP constantly clean optimization, just feel the speed slightly improved point, Even if the mobile phone in a variety of performance in front of the software score ahead, or feel n
Save global variables in Android
Sometimes our app needs to save some variable values for programs to call anywhere, so we will use the Save method of global variables. Here we will introduce two methods for your reference.
1: use application to
The fluency of the Android system has been compared to iOS and is considered inferior to the latter. This aspect is related to the uneven quality of the Android device, on the other hand, and the implementation of the Android system. For example, before 3.0, the Android application UI drawing does not support hardware
. This is an optional activity. When you add an app widget, it is loaded and allowed to modify the settings of the app widget during creation.
The following sections describe how to create these components:
Declare An application widget in the list
First, declare the appwidgetprovider class in the androidmanifest. xml file of the application, for example:
The
The The widget is broadcast to appwidgetprov
Helloworldproject creation and execution
Android App 1.New, ProjectIf not found, can go to other----Android found, is the same:2. Then enter project information in turn:3. Execute the Created program4. See the execution effect from the simulator:
5. Folder structure analysis of the project
Let's take a look at our project folder diagram:Wh
Speaking of Android phone, most people's impression is a bit of time to become a little lag, some programs in the run inexplicably crashes, open the System folder A look, found a lot of files, and then use the mobile phone butler APP constantly clean optimization, just feel the speed slightly improved point, Even if the mobile phone in a variety of performance in front of the software score ahead, or feel n
ExperimentCreate Android apps from the command line This article is primarily to build an Android environment, then create an Android app from the command line , compile and package with Ant, and deploy with adb . (This article is mainly to prevent the next time to build the Androi
App application is more and more humane, not only the interface is beautiful and the service is also very diverse, operation is also very convenient. For example, when we use the app, we find that there is a comparison on the image to save to the phone, just click on the app to provide the
Android log Print class Logutils, able to navigate to the class name, method name, and number of rows where the error occurred and save the log file
In development, we often use print log to debug our application. In Java we often use Method System.out.println () to print logs in the console for our debugging. There is a dedicated class log in Android to ena
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.