Android Simulator simulates the implementation of mobile assistant app download process

Source: Internet
Author: User

In view of the basic Android learning experience in the past few weeks, I would like to share the steps for downloading the simulated mobile Assistant of the Android simulator. When I use a mobile assistant to download software, I don't think it is easy to use computer languages.

Not to mention, go directly to the topic.

1. We use a virtual server to simulate a mobile phone to download resources from the network.

2. Create an Android Application Project

3. add permissions: add three permissions to the project in the AndroidManifest. xml file.

1) android. permission. INTERNET -- download resources from the simulated Server

2) android. permission. READ_EXTERNAL_STORAGE -- Implement read operations in the stream

3) android. permission. WRITE_EXTERNAL_STORAGE -- Implement write operations in the stream

4. Deploy the layout File

1) Place the ListView control in the activity_main.xml file.

2) create an xml file in the layout folder to deploy the layout and content of each row in layout.

5. Enable the Android simulator to view the implementation of each step, which is easy to modify. If all the code is written and then run, the FC may have many associated errors, errors are not in the same place, which makes it very difficult to correct the code. Therefore, it is necessary to develop and run the code one step instead of writing it all before running it.

6. Start in the MainActivity. java file.

1) because we cannot obtain text resources from the network, we will write the title and description of the app into the Code:

2) define four HashMap containers for storing the identifiers required during the encoding process.

3) Find the ListView Control

4) create a new class Myadapter to inherit the BaseAdapter and rewrite the method:

5) Add a tile to the getView method in the Myadapter class. Find the layout converter and various controls

6) download the icons corresponding to each app from the virtual server. Downloading is time-consuming, so it cannot be performed in the main thread, in this case, you need to enable a new asynchronous thread to download the app icon.

7) download the corresponding installation package for each app from the virtual server.

8) determine the status of each app and assign values when the screen slides up or down through the set container.

7. Run the Android simulator to view the overall effect.

This completes the entire small project. Because I wrote a blog post for the first time, many standards are unclear, and the interspersed descriptions of images are very lacking. This is mainly for those who want to develop in the direction of Andoird or who are new to the basic part of Android, write a frequently used case later. Just look at it. Do not spray it.

This article from the "black humor" blog, please be sure to keep this source http://7813345.blog.51cto.com/7803345/1290412

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.