default shared preferencesSharedpreferences sharedpref = preferencemanager.getdefaultsharedpreferences ( This); Final intCounter = Sharedpref.getint (advancedpreferences.key_my_preference, 0); Mcountertext.settext (getString (r.string.counter_value_is)+ " " +counter); }You can see that the value of a preference obtained from a shared preferences is defined by its key value and then called GetXXX (key:). To obtain.The value of Mypreference is displayed in Launchingpreferences after returning fro
= "Customfont.customfontcolor">4 5 style>6 7 Resources> 1.2 Setting themes for activity or applicationTo set the theme for Activity or application, in the Androidmanfest.xml file, in the 1 Application2 Android:allowbackup= "true"3 Android:icon= "@mipmap/ic_launcher"4 Android:label= "@string/app_name"5 Android:supportsrtl= "true"6 Android:theme= "@style/apptheme">7 8 Activity9 Android:na
The Reorder activities sample has four related activitives:reorderonlaunch, Reordertwo,reorderthree, Reorderfour. Where Reorderonlaunch is started by the main activity,reorderonlaunch reordertwo, Reordertwo starts reorderthree,reorderthree. In this case the "back stack" of the activity has the following status:
Reorderfour want to start reordertwo again, then use two implementations, one is on the record
Android provides a variety of ways to store data, the simplest of which is to use shared Preferences. Shared Preferences can store key/value pairs, shared Preferences support Access Boolean, float, long, Integer, string, most commonly used shared preference S is used to store some application preferences. Another approach is to use Onsaveinstancestate (), which is especially useful for saving UI state.
app->activ
App-Activity-PersistentState1.Demo description and demo
This demo uses sharedpreference to save the UI status, mainly to demonstrate the simple use of sharedpreference, And the UI status is generally saved in onsaveinstancestate.
Through this demo, we can learn:
Simple use of sharedpreference
Introduction to preferencemanage
Use of scrollview
Introduction to horizontalscrollview
As follows:
2. Video
You need to do a small activity on the app project, first look at the page layoutThe requirement is that these 5 plates are displayed one by two, and the whole page scrolls up a certain distance.At the beginning of the consideration, is to prepare to rely on the CSS3 property of the transition implementation, including the sequential delay is not any problem, but until the real implementation, found unable
One, no apk, the app has been installed in the phone or virtual machine1.logcat. Clear Logcat content, use command adb logcat-c. Start Logcat, use the command adb logcat activitymanager:i *:s. Start the program you want to view,2.dumpsys(1) Start the program you want to view;(2) command line input: adb shell dumpsys window w |findstr \ |findstr name=Add: Use adb shell Dumpsys window | findstr mcurrentfocus command to view the currently running package
Android provides a variety of data storage methods, the simplest of which is to use Shared Preferences. shared Preferences can store Key/value pairs. Shared Preferences supports accessing boolean, float, long, integer, string. The most common use of Shared Preferences is to store some application Preferences. In addition, onSaveInstanceState () is used to save the UI state.
App-> Activity-> Persistent State
First, the source of the situationOpen the Androidmanifest.xml file directly and find the activity that contains the Android.intent.action.MAIN and Android.intent.category.LAUNCHER. If the third line of the package is Com.cola.ui, the seventh row of the main activity is Com.cola.ui.ColaBox (. Colabox is the activity shorthand method). Two, only the situation
This method is encapsulated in my app that needs to see my app and determine if an activity is running on the phone interfacePackageName is a package name that needs to be judged to be applied, such as Com.xy.tencentIt is also possible to determine whether an activity is displayed on the current phone, or the complete
it.The contactmanager shown here is the main activity of the app under test.Method ThreeRefer to this post in TesterhomeUse log to view Dafa (well, no grep on Windows is not happy, fortunately there are PowerShell select-string, can be used to force a use), directly to move bricks.
A. Launch the apk you want to testb, turn on the log output: adb logcat>d:/log.txtC, turn off the log output: Ctrl +
My classmates run javah com.cn. ndk22.Ndk22. Activity in the ndk22/bin/classes project. The. h file appears.
I am in the bin/classes directory and cannot access it,
: Error: unable to access android. app. Activity
Android. app. Activity not found
As shown in
So I w
App->activity->custom Dialog example uses an activity to implement a custom dialog box. The class customdialogactivity itself is nothing special. The key point is its definition in Androidmanifest.xml:
Customdialogactivity used the Customdialog style (Theme).
Android apps can use custom interface styles (Theme), Theme for a set of related style defi
Once the environment has been configured successfully, we are ready for the first automated test. You do not need to install an Android emulator to use a real machine. Take a simple open app as an example.First, get the package name and activtity to launch an app, we need to know its platform, version number, package name, activity and other information, of which
Background:Working with Appium to make Android's automation function use casesProblem:The QQ APK is encrypted, and is truncated in the XML file directly apktool the anti-compile. Unable to get startup activity name;Problem Solving methods:By observing the log method:Steps:
Turn on log output: adb logcat>d:/log.txt
Launch the APK to be tested, open the interface (ie open the QQ interface)
Turn off log output: Ctrl + C
To view the logs, f
method One:adb shellmonkey-p package name-v-v-V 1method Two:aapt dump bading apk where the path \apk name (or directly put the APK into the command line) after running the results of the following two lines are the application package name and the entry activity name Package:name= ' com.xxx.android.xx ' launchable-activity:name= ' com.xxx.android.xx.view.xxxrActivity ' Note: on Android The SDK directory search can be found Aapt.exe if no apktool can b
Android activity capture method to return button to close app@Override public boolean onKeyDown (int keycode, keyevent event) { //press the key on the keyboard to return the button if (keycode = = Keyevent.keycode_back) { new Alertdialog.builder (This) . SetIcon (R.drawable.alert_dialog_icon) . Settitle ("hint") . Setmessage ("Do you want to close the app
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.