SD卡寫入數據權限http://" />

亚洲免费在线-亚洲免费在线播放-亚洲免费在线观看-亚洲免费在线观看视频-亚洲免费在线看-亚洲免费在线视频

SD卡讀寫文件 代碼學習

系統 1762 0

把文件存入SD卡中

首先加入讀寫權限

SD卡創建與刪除文件權限

<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"></uses-permission>

SD卡寫入數據權限

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>

\" src= http://schemas.android.com/apk/res/android "
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>

<RelativeLayout xmlns:android=" http://schemas.android.com/apk/res/android "
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">

<TextView
android:layout_width="90px"
android:layout_height="wrap_content"
android:text="文件名稱:"
android:textSize="21px"
android:id="@+id/filenamelebal"
/>

<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/filenamelebal"
android:layout_alignTop="@id/filenamelebal"
android:id="@+id/filename"
></EditText>
></RelativeLayout>

<TextView
android:layout_width="90px"
android:layout_height="wrap_content"
android:text="內容:"
android:textSize="21px"
/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minLines="3"
android:id="@+id/content"
></EditText>
<LinearLayout android:id="@+id/linearLayout1" android:layout_width="match_parent" android:layout_height="wrap_content">
<Button
android:layout_height="wrap_content"
android:id="@+id/baocun"
android:text="保存"
android:layout_width="wrap_content"></Button>
<Button
android:text="讀取"
android:id="@+id/read"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></Button>
<Button
android:text="退出"
android:id="@+id/exit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></Button>

</LinearLayout>
<TextView
android:text="讀取內容顯示"
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>



</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=" http://schemas.android.com/apk/res/android "
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>

<RelativeLayout xmlns:android=" http://schemas.android.com/apk/res/android "
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">

<TextView
android:layout_width="90px"
android:layout_height="wrap_content"
android:text="文件名稱:"
android:textSize="21px"
android:id="@+id/filenamelebal"
/>

<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/filenamelebal"
android:layout_alignTop="@id/filenamelebal"
android:id="@+id/filename"
></EditText>
></RelativeLayout>

<TextView
android:layout_width="90px"
android:layout_height="wrap_content"
android:text="內容:"
android:textSize="21px"
/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minLines="3"
android:id="@+id/content"
></EditText>
<LinearLayout android:id="@+id/linearLayout1" android:layout_width="match_parent" android:layout_height="wrap_content">
<Button
android:layout_height="wrap_content"
android:id="@+id/baocun"
android:text="保存"
android:layout_width="wrap_content"></Button>
<Button
android:text="讀取"
android:id="@+id/read"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></Button>
<Button
android:text="退出"
android:id="@+id/exit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></Button>

</LinearLayout>
<TextView
android:text="讀取內容顯示"
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>



</LinearLayout>

配置文件


[java]
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=" http://schemas.android.com/apk/res/android "
package="com.luku.file"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"></uses-permission>

<application android:icon="@drawable/icon" android:label="@string/app_name">
<uses-library android:name="android.test.runner"></uses-library>
<activity android:name=".fileActivity"
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>

<instrumentation
android:name="android.test.InstrumentationTestRunner"
android:targetPackage="com.luku.file"
android:label="Test for my app"
></instrumentation>

</manifest>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=" http://schemas.android.com/apk/res/android "
package="com.luku.file"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"></uses-permission>

<application android:icon="@drawable/icon" android:label="@string/app_name">
<uses-library android:name="android.test.runner"></uses-library>
<activity android:name=".fileActivity"
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>

<instrumentation
android:name="android.test.InstrumentationTestRunner"
android:targetPackage="com.luku.file"
android:label="Test for my app"
></instrumentation>

</manifest>

摘自 奔跑的蝸牛

SD卡讀寫文件 代碼學習


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 人人干人人舔 | 成人久久久久 | 成人免费视频一区二区 | 天天亚洲综合 | 国产精品视频九九九 | 日本一级特大毛片 | 国产一区二区视频在线播放 | 亚洲精品9999久久久久 | 四虎高清在线精品免费观看 | 久久好看视频 | 深夜福利免费观看 | 伊人69| 狠狠操天天操夜夜操 | 欧美在线观看高清一二三区 | 国产好大好爽久久久久久久 | 俄罗斯毛片视频 | 青青草免费在线视频 | 欧美videofree高清杂交 | 天天影视欧美综合在线观看 | 97se亚洲综合在线天天 | 真人特级毛片免费视频 | 欧美性一区二区三区五区 | 午夜精品久久久久久 | 欧美大片毛片大片 | 无遮挡一级毛片视频 | 亚洲精品一区二区三区四区 | 在线不卡福利 | 久久久美女 | 女性一级全黄生活片免费看 | 色综合视频 | 免费亚洲成人 | 草久在线观看 | 亚洲综合色色图 | 日韩永久免费进入2015 | 韩日一级毛片 | 99精品国产在热久久 | 国产成人在线视频免费观看 | 午夜主播国产福利视频在线 | 欧美日韩国产精品 | 久热这里只有精品6 | 久久天天躁夜夜躁狠狠躁2020 |