Piglet's Android starter Road Day 7 Part 1

Source: Internet
Author: User

Before starting a new day, integrate what we learned in the first 6 days

Day 1: Background knowledge of Android, platform architecture and related features, and development environment building

Day 2: initial understanding of four components, app Lifecycle, App Engineering Catalog understanding, developing simple Phone Dialer,

Six layouts, three kinds of hints; nine sister 9patch work making local scaled footage

Day 3: Some basic UI components commonly used by Android

Day 4: The event handling mechanism of Android: monitoring and callback based event monitoring, handler information transmission mechanism; Android Touch Event

Configuration response System-set events, Ayynctask asynchronous tasks for simpler UI threading operations

Day 5: Android Basic program Unit--activity concept, life cycle, data exchange of multiple activity, four different loading modes

Activity fragment--fragment (fragmentation) concept, life cycle, static and dynamic loading fragment,fragment and activity

Interactive , fragment management and business

Day 6: The core--intent (intent) concept of Android app, explicit Intent with implicit intent,intent of seven attributes, system pre-defined with

Custom implicit Intent

If you have learned in the previous six days, you can deploy some of the more simple apps, you can make a custom UI interface to achieve a few clicks

Page Jump! Well, if we're going to make a simple notepad now, I'm sure everyone is making their own interface, but actually writing

things in, those where to save the information ? We seem to only learn the past intent. Putextras () writes data to the bundle type, but if

What about the next time we re-open the software? Everything that was written before is gone! So we need some ways to persist our data,

For example, we save the data to a file, or the database, and so on! Believe see here you've kinda

Want to try it, OK, start learning Android data storage and access to the day!




Learning Roadmap for this section:





Body:



Introduction to Android file operation:









android Files Read and write:



code example:

:



After running, look at file exploer to see the,data/data/< package name >/file The corresponding file already exists:



In addition, click the corresponding icon in the upper right corner to export the file to your computer:



Reference code Download: Click to download





read and write files on SD card:



code example:

:


After running to the SD card directory, you can see:

Description file generated successfully!




Reference code Download: code Download





some problems with SD card:

If the real machine debugging is usually possible, for the virtual machine is a lot of problems, before we use

Environment.getexternalstoragestate (). Equals (environment.media_mounted) may have been returning false

, that is, the SD card does not exist, this is the main problem, now the new version of the SDK will be created in the AVD

Apply for a storage area of an SD card at the same time


For older versions of the SDK or other reasons may need to be manually associated with the SD card, set the following:


① find the path to the image of the created AVD:

Click Open AVD Interface, click Detail to view the AVD image under the directory




② come to the path where the AVD image is located, copy the path of the sdcard.img:

Like mine:-sdcard C:\Users\Administrator\.android\avd\Jay4.2.avd\sdcard.img.



③ then clicks to the following interface:


Finally apply the following, then run on it!

Related Article

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.