In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail what the components of the Android mobile phone program are, and the content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
Android as an important part of Google's corporate strategy, this strategy has greatly improved Google's mobile phone market in China, but also greatly promoted the competitiveness of the entire mobile phone industry, the following is to introduce the content of Android mobile phone program.
In this way, when you start the program, you will start an Application, and then load the corresponding Activity as the Application runs, while Activity requires an interface. But that's not the case with Instrumentation. You can think of Instrumentation as something that has no graphical interface and has the ability to start.
A utility class used to monitor other classes (declared in Target Package). Any class that wants to be Instrumentation must inherit android.app.Instrumentation. Here is the explanation for this class:
Private SensorEventListener listener = new SensorEventListener () {public static volatile float direction = (float) 0; public static volatile float inclination; public static volatile float rollingZ = (float) 0; public static volatile float kFilteringFactor = (float) 0.05; public static float aboveOrBelow = (float) 0; public void onAccuracyChanged (Sensor arg0, int arg1) {} public void onSensorChanged (SensorEvent evt) {float vals [] = evt.values If (evt.sensor.getType () = = Sensor.TYPE_ORIENTATION) {float rawDirection = vals [0]; direction = (float) ((rawDirection * kFilteringFactor) + (direction * (1.0-kFilteringFactor) Inclination = (float) ((vals [2] * kFilteringFactor) + (inclination * (1.0-kFilteringFactor); if (aboveOrBelow > 0) inclinationinclination = inclination *-1 If (evt.sensor.getType () = = Sensor.TYPE_ACCELEROMETER) {aboveOrBelow = (float) ((vals [2] * kFilteringFactor) + (aboveOrBelow * (1.0-kFilteringFactor);}}
For unit testing, what we need to understand carefully is the android.test.InstrumentationTestRunner class. This is the main entry point for unit testing of Android mobile applications. It is equivalent to the role of TestRunner in JUnit. So how to load it, first add a line of declaration about Instrumentation in the manifest file. For example, the manifest in the test in Android Api Demos is written like this (I filtered out all the comments):
After editing the manifest, you can package it (build, which can be done with Eclipse ADT or manually with the aapt command) and install it on the virtual machine (with the adb install command). You can then use the command line to load your unit tests. The way to load an Instrumentation in Shell, an Android mobile app, is to use commands.
Of course, you can also use adb shell to enter android command line mode first, and then write am instrument-w XXXXXXX directly.
About how the Android mobile phone program components are shared here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.