Environment: Android 0.5.2 + gradle 1.11 + Kindle Fire
Download, download the project, load resources from the Internet, and save it to the local SD card.
Click on the Download button, download the picture, then display the download content, you can click to view.
Specific design of Download:
1. Modify Activity_main.xml
Location: Res->layout->activity_main.xml
<relativelayout xmlns:android= "http://schemas.android.com/apk/res/android xmlns:tools=" http:// Schemas.android.com/tools "android:layout_width=" match_parent "android:layout_height=" Match_parent "Android:pa" ddingleft= "@dimen/activity_horizontal_margin" android:paddingright= "@dimen/activity_horizontal_margin" Android: paddingtop= "@dimen/activity_vertical_margin" android:paddingbottom= "@dimen/activity_vertical_margin" tools:
context= "Mzx.spike.download.app.MainActivity" > <button android:id= "@+id/download_button"
Android:layout_width= "Match_parent" android:layout_height= "wrap_content" android:text= "Download"/> <textview android:text= "@string/hello_world" android:layout_width= "Wrap_content" an droid:layout_height= "Wrap_content" android:layout_below= "@id/download_button"/> </relativelayout& gt;
Add a button to make "Hello_world" below it, using the Layout_below property;
2. Modify Androidmanifest.xml
Location: Main->androidmanifest.xml
<?xml version= "1.0" encoding= "Utf-8"?> <manifest xmlns:android= "http://schemas.android.com/apk/res/" Android "package=" Mzx.spike.download.app "> <uses-permission android:name=" Android.permission.INTER NET "/> <uses-permission android:name=" Android.permission.WRITE_EXTERNAL_STORAGE "/> <a Pplication android:allowbackup= "true" android:icon= "@drawable/ic_launcher" android:label= "@string/ App_name "Android:theme=" @style/apptheme "> <activity android:name=" mzx.spike.download . App. Mainactivity "android:label=" @string/app_name "> <intent-filter> < Action android:name= "Android.intent.action.MAIN"/> <category android:name= "Android.intent" . category. LAUNCHER "/> </intent-filter> </activity> </application> < /manifest>
Need the Internet, the right to connect to the Internet; Write_external_storage, writes the memory the permission;
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/extra/