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條評論
主站蜘蛛池模板: 老司机午夜在线 | 四虎影院在线网址 | 九九精 | 欧美日韩一区二区高清免费视频 | 国产成人精品一区二区三在线观看 | 午夜网站在线观看免费网址免费 | 欧美成人h版影片在线观看 欧美成人h精品网站 | 搡的我好爽视频在线观看 | 国产一级二级在线观看 | 很很鲁在线视频播放影院 | 国产特黄一级一片免费 | 美国一级毛片片aa成人 | 精品少妇一区二区三区视频 | 日韩欧美毛片免费看播放 | 色在线播放 | 99精品欧美一区 | 97精品久久久久中文字幕 | 久久最稳定资源站在线 | 成人在免费观看视频国产 | 精品一区二区在线观看 | snh48欧洲大片在线观看 | 亚洲国内| 国产成人亚洲毛片 | 久久伊人免费 | 国产欧美精品一区二区三区-老狼 | 成人午夜视频在线 | 毛片网站视频 | 国内在线观看 | 搜毛片 | 夜夜狠狠| 国产欧美国产精品第一区 | 精品热99 | 久青草免费在线视频 | a成人毛片免费观看 | 青青青免费手机版视频在线观看 | 全高清特级毛片 | 亚洲色四在线视频观看 | 精品视频一区二区三区在线播放 | 日日摸天天摸狠狠摸视频 | 综合色久 | 手机看片在线精品观看 |