In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "how to install and configure Android 2.2 environment". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
I. Environmental configuration and installation of Android 2.2
1 、 JDK
2 、 SDK
Download address:
Http://dl.google.com/android/android-sdk_r06-windows.zip
3. Eclipse3.5 (Galileo)
Download address:
Http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/galileo/R/eclipse-java-galileo-win32.zip
4 、 ADT0.9.7
Download address:
Http://dl.google.com/android/ADT-0.9.7.zip
5. Installation
Download it in turn and install it according to the steps of the article. Note that when installing SDK, you need to set the following settings:
Otherwise, it won't be updated, and the link address will be walled.
II. Android 2.2 system architecture
1. Linux kernel (LinuxKernel)
* Android 2.2 runs on top of linuxkernel2.6, but replaces the part of the linux that is bound by the GNU protocol, so that programs in Android can be used for commercial purposes.
* the Linux kernel is the abstraction layer between the hardware and software layers.
2. Middleware
* Middleware consists of two parts: core library and runtime (libraries&Androidruntime)
* the core library includes SurfaceManager display system management library, which is responsible for displaying 2D or 3D content to the screen; MediaFramework media library, which is responsible for supporting images and supporting a variety of video and audio recording and playback; SQlite database, a powerful lightweight embedded relational database; WebKit browser engine, etc.
* Dalvik virtual machine: unlike the Java virtual machine, each Android application runs in its own process and has its own Dalvik virtual machine, which allows the system to be optimized at runtime and the impact between programs is greatly reduced. Instead of running Java bytecode, the Dalvik virtual machine runs its own bytecode.
3. Application Framework (ApplicationFramework)
* Rich and extensible views (Views) that can be used to build applications, including lists, grids, textboxes, buttons, and embeddable web browsers.
* content providers (ContentProviders) enable applications to access data from another application, such as a contact database, or share their own data.
* Resource Manager (ResourceManager) provides access to non-code resources, such as local strings, graphics, and layout files (layoutfiles).
* Notification Manager (NotificationManager) enables applications to display custom prompts in the status bar.
* the activity Manager (ActivityManager) is used to manage the application lifecycle and provide common navigation fallback functions.
4. Application (Applications)
* the Android system will have some application packages built into it, including email client, SMS short message program, calendar, map, browser, contact manager, etc. All applications are written in Java.
3. Android 2.2 system package description
Android.app: provides a high-level program model and a basic running environment
Android.content: contains various classes for accessing and publishing data on the device
Android.database: browsing and manipulating databases through content providers
Android.graphics: the underlying graphics library, including canvases, color filters, dots, rectangles, which can be drawn directly to the screen.
Android.location: classes for location and related services
Android.media: provides some media interfaces for managing a variety of audio and video
Android.net: classes that provide help with network access, beyond the usual Java.net.* interface
Android.os: provides system services, message transmission, IPC mechanism
Android.opengl: a tool for providing OpenGL
Android.provider: a content provider that provides class access to Android
Android.telephony: provides API interaction related to making phone calls
Android.view: provides a basic user interface framework
Android.util: involves instrumental methods, such as time and date operations
Android.webkit: default browser operation interface
Android.widget: contains various UI elements (mostly visible) for use in the application's screen
IV. Android 2.2Project description
Src: stores the java source code.
Gen: stores the java code automatically generated by the compiler, and the files in this directory are automatically maintained by the system.
Assets: files stored in this directory, whether mp3 or images, are packaged into the distribution package.
Res: resource file directory, all the files added to this directory will be displayed in the R.ava file under gen; if the resources stored in res are not used in the application, then they will not be displayed in the R.java file under gen, so these resources will not be packaged, reducing the size of the released file of the application.
Drawable: store the picture file. Note that the name of the picture must be [a-z0-9 pictures.] Composition; there is no molecular directory under the drawable directory and can only be distinguished by naming methods.
Layout: stores UI-related layout files, all xml files.
Raw: any file that is copied directly to the device will not be compiled and can be put into the database file.
Values: stores constant data such as strings, colors, arrays, etc. You can name anything you want, but it is usually named: color.xml, strings.xml, array.xml, styles.xml, dimens.xml (definition size value: dimensionvalue)
Xml: any XML file that can be read at run time by calling Resources.getXML ().
5. Basic controls
1. Text box (TextView), automatic completion (AutoCompleteTextView)
Autocomplete effects and code: http://android.yaohuiji.com/archives/390
AutoCompleteTextView:
2. Edit box (EditText)
Information that reminds you when the android:hint content is empty, such as "Please enter"
3. Drop-down list (Spinner)
Android:entries can set options by specifying string-array in strings.xml.
4. Progress bar (ProgressBar)
Effect and code:
Http://www.eoeandroid.com/viewthread.php?tid=1081
5. Drag the bar (SeekBar)
6. Score bar (RatingBar)
7. Button (Button), picture button (ImageButton)
Button:
ImageButton:
8. Picture frame (ImageView), gallery (Gallery)
ImageView
Gallery
Gallery effects: http://android.yaohuiji.com/archives/565
9. Date and time (DatePicker, TimePicker)
AnalogClock
DigitalClock
Chronometer (timer)
DatePicker
DatePickerDialog
TimePicker
TimePickerDialog
10. Single choice (RadioGroup, RadioButton), multiple choice (CheckBox)
CheckBox
RadioButton
ToggleButton
11. Table (GridView), list (ListView)
GridView
ListView
GridView: http://blog.csdn.net/hellogv/archive/2009/09/18/4567095.aspx ListView: http://www.cnblogs.com/allin/archive/2010/05/11/1732200.html
12. Dialog box (AlertDialog), progress bar in dialog box (ProgressDialog)
AlertDialog
AlertDialog: http://android.yaohuiji.com/archives/655
ProgressDialog: http://aina-hk55hk.javaeye.com/blog/679134
13. Menu (Menu)
14. Prompt (Toast)
Similar to MessageBox, modeless windows. Such as:
Toast.makeText (this, "Information", Toast.LENGTH_SHORT). Show ()
15 、 GestureOverLayView
Article 1, article 2
16 、 HorizontalScrollView
17 、 MapView
18 、 VideoView
19 、 WebView
20 、 ZoomControls
VI. Layout and containers
1. Frame layout (FrameLayout)
All elements placed in it are placed in the upper-left area, and an exact location cannot be specified for these elements. If there are multiple child elements, the display of the subsequent child elements will overlap on the previous element.
2. Linear layout (LinearLayout)
Commonly used layouts, with child elements arranged in rows or columns.
Android 2.2:layout_gravity is the direction of gravity of this element to the parent element.
Android 2.2:gravity is the direction of gravity of all the child elements of this element.
3. Absolute layout (AbsoluteLayout)
You can have the child elements specify the exact xstroke y coordinate value, (0Pol 0) is the upper-left corner, there is no page border, allowing elements to overlap each other.
4. Relative layout (RelativeLayout)
Allow child elements to specify their position relative to other elements or parent elements (specified by ID)
5. Table layout (TableLayout)
Assign the position of the child element to a row (TableRow), and note that no border lines are displayed and cells cannot be merged across rows.
Example:
Http://hi.baidu.com/hoyah/blog/item/d9db34275d6f361a8b82a171.html
6. Tab (TabWidget)
Example:
Http://fatkun.com/2010/06/android-tabwidget.html
7. Common codes
1. Start another Activity in the current Activity
StartActivity (newIntent (this, target Activity.class))
2. Find the control from the current ContentView
(Button) findViewById (R.id.btnAbout) R.id.btnAbout refers to the control id.
3. Get the width and height of the screen
DisplayMetricsdm=newDisplayMetrics (); / / get window properties getWindowManager () .getDefaultDisplay () .getMetrics (dm); intscreenWidth=dm.widthPixels;//320 intscreenHeight=dm.heightPixels;//480
4. No title bar, full screen
/ / requestWindowFeature without title bar (Window.FEATURE_NO_TITLE); / / full-screen mode getWindow () .setFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN)
Note that it is called before setContentView (), otherwise it is invalid.
5. Register for activity
All Activity used must be registered in AndroidManifest.xml, otherwise a null pointer error will be reported. For example, note that it is the package name + class name.
8. Adb command line
1. DOS enters the android-sdk-windows\ tools directory
2 、 Linux
Login linux command: adbshell
List the current file: ls
Delete files: rm file name
3 、 Sqlite
Login sqlite command: sqlite3
4. Adb command
List what currently active simulators are available: adbdevices
Upload file: adbpush
Install the apk file: adbinstallandroid123.apk
9. Cracking of Apk files
1. Get the resource pictures of apk
Open it directly with WinRAR and drag it out with res/drawable.
2. Get xml file information
Although you can use WinRAR to see the xml file inside, but xml is optimized, can not be viewed directly, need to use the apktool tool, download address: https://code.google.com/p/android-apktool/.
Download apktool-1.3.1.tar.bz2 and apktool-install-windows-2.2_r01-2.tar.bz2 to the same directory, then copy the apk files to be cracked to the same directory, DOS enter the directory, type: aaptd91callinfo.apk91callinfo, where the fourth parameter is the path to the cracked storage.
3. Decompile dex to get Java source code
Apktool tools can only be decompiled into intermediate code files of smali. Here you need another open source tool: dex2jar, download address: http://code.google.com/p/dex2jar/. This tool cannot be directly translated into java files, but it can convert dex files into jar files, and then decompile jar files into Java source files through the jad tool. If you just look at the source code, you can use jd-gui.
The dex file (classes.dex) can be extracted from the apk file using WinRAR.
10. Tips
1. Use the icon of the system
For example, the icon that calls the system:
Icon name and effect (Android1.5 and 1.6):
Http://since2006.com/android/1.5-drawables.php http://since2006.com/android/1.6-drawables.php
2. Make controls transparent, such as ImageButton
Set android:background= "@ null"
3. Specify the onclick method directly in layout
Instead of manual binding, set android:onClick= "methodName" in layout. MethodName is the method in the corresponding Activity. The format is as follows: publicvoidmethodName (Viewview) {} (suitable for version 1.6 or above)
4. Use PC keyboard to control the simulator
PC keyboard simulator keystroke description
HomeHome home page
F2Menu menu
EscBack back up
F3Call, make the call.
F4Hangup hang up
F5Search search
Ctrl+F12 horizontal and vertical screen switching
5. Show / hide the soft keyboard when you enter the interface
Set the activity's in AndroidManifest.xml
Android:windowSoftInputMode= "stateHidden"
6. Visual layout tools for interface
The visual layout provided by the system is not easy to use. One is recommended here. After the layout, you can generate the code:
DroidDraw: http://www.droiddraw.org/
7. Look at the source code of Android in Eclipse
Just copy the source code to android-sdk-windows\ platforms\ android-4\ sources. Note that the source code version corresponds to the android-4 folder, which refers to the source code of Android1.6.
Eleven. Qizha
1. Frequently fail to connect to debug with simulator, or report errors in emulator-5554disconnected?
Window (window)-> ShowViews (display View)-> device- > viewmenu (View menu)-> Resetadb
2. How to use this in anonymous classes?
Classname (class name) .this
3. After a program error, the simulator only shows that the application will be closed if there is a problem?
You can check for errors from LogCat. The default LogCat is in the DDMS view. You can adjust the Java view to display side by side with the console by the following ways: click on the lower left corner of Eclipse, click on it, and then find the LogCat in the directory of Android 2.2 and drag it out.
This is the end of "how to install and configure the Android 2.2 environment". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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: 300
*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.