導航:首頁 > 文件目錄 > android文件中文路徑

android文件中文路徑

發布時間:2023-06-06 21:06:21

『壹』 android 文件路徑問題

一個是應用的文件目錄
一個是sdk的文件路徑

『貳』 android的項目里怎麼規定文件路徑的

方法一:把目標文件放入resources文件中,以通過讀取R的資源文件來獲取,具體方式如下:

1、在res下新建raw文件,將帶讀取文件添加到raw文件目錄下。

2、添加如下代碼

// 如果要使用文件名獲取文件數據:首先獲取資源id然後再通過id獲取輸入流

InputStream im = getResources().openRawResource(R.raw.h_data11);

BufferedReader read = new BufferedReader(new InputStreamReader(im));

String line = "";

StringBuilder sb = new StringBuilder();

try {

while((line = read.readLine()) != null) {

sb.append(line).append("\n");

}

} catch (IOException e) {

e.printStackTrace();

} finally {

if(read != null) {

try {

read.close();

read = null;

} catch (IOException e) {

e.printStackTrace();

}

}

if(im != null) {

try {

im.close();

im = null;

} catch (IOException e) {

e.printStackTrace();

}

}

}

Log.v("", "result = " + sb.toString());

方法二:使用assets 只讀文件進行讀取。

1、將文件到assets下,可以新建文件夾如:「www」然後將文件放入www文件夾中,讀取的path為:"www/filename"

String result = "";

ObjectInputStream ois = null;

AssetManager am = context.getResources().getAssets();

try {

ois = new ObjectInputStream(am.open("www/filename"));

result = (String) ois.readObject();

} catch (StreamCorruptedException e) {

e.printStackTrace();

} catch (FileNotFoundException e) {

e.printStackTrace();

} catch (IOException e) {

e.printStackTrace();

} catch (ClassNotFoundException e) {

e.printStackTrace();

} finally {

try {

if (ois != null) {

ois.close();

ois = null;

}

} catch (IOException e) {

e.printStackTrace();

}

}

以對象的方式讀取文件中的數據,如果沒有新建文件夾,把前面的「www/」去掉就ok啦

以上方式我都還有疑問的地方:
1、raw下新建多級目錄是否真的不能夠使用。

『叄』 android系統中的app安裝後的各個文件路徑在哪裡

在系統中system/app文件夾中。

在android系統中安裝軟體時,系統會將其安裝在設定好的路版徑當中,即system/app路徑。後來下權載的APP可以卸載,但系統自帶的APP不能卸載,否則會引發系統的崩潰。

在安裝APP時,也可以直接將文件復制到手機里(手機內存、Storage Card都可以),在手機上執行該CAB文件即可安裝。

(3)android文件中文路徑擴展閱讀

android系統中的app不同格式安裝:

1、CAB格式,直接將文件到手機里,都可以在手機上執行該CAB文件即可安裝。

2、EXE格式,EXE格式的程序可分為手機上直接運行(即綠色軟體的形式)和連接電腦同步安裝2種形式。

3、免安裝軟體(綠色軟體),將文件直接拷貝到手機里(手機內存、Storage Card都可以)即可運行。這種軟體在網上下載時一般是RAR或ZIP格式壓縮包,只需先在電腦上解壓,將解壓出來的文件夾拷貝到手機里即可運行。

4、Cpl文件,將文件直接拷貝到手機windows目錄下,即可在設置中出現相應的選項。如SoftKeyAppleEx.cpl對應會出現軟體設置選項。

『肆』 android系統中的app安裝後的各個文件路徑在哪裡

工作路徑在data/data/,但是不是像你說的那樣都解壓出來,你可以去哪個目錄看看
查看原帖>>

『伍』 android 文件路徑怎麼寫

"./user_set"是Unix的寫法

Android寫法:
// SD卡存儲
SDPATH = Environment.getExternalStorageDirectory() + "/user_set";
// 內部存儲
FILESPATH = context.getFilesDir().getPath() + "/user_set";

『陸』 如何寫android指定文件路徑

Android根據路徑打開文件夾的步驟:
1、android系統內置了很多應用,包括電話撥號,簡訊,瀏覽器等,這里創建一個簡單的Android程序,調用內置的瀏覽器打開指定的地址。
2、對應的layout 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" >
<Button
android:id="@+id/btnGo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginTop="46dp"
android:text="@string/btnTitle_go" />
<EditText
android:id="@+id/txtUri"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/btnGo"
android:layout_alignBottom="@+id/btnGo"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/btnGo"
android:ems="10"
android:text="http://junqilian.cnblogs.com" >
<requestFocus />
</EditText>
</RelativeLayout>
3、Java代碼實現如下,主要是給EditText添加一個OnKeyListener,處理在editText裡面按回車鍵,給button添加一個onClickListener,觸發到OpenBroswer函數,通過intent打開內置的瀏覽器。

閱讀全文

與android文件中文路徑相關的資料

熱點內容
製作單文件軟體 瀏覽:692
什麼網站貸款方便 瀏覽:712
app上傳圖片php 瀏覽:887
網頁性能測試工具 瀏覽:940
文件夾怎麼壓縮發 瀏覽:166
蘋果5的文件在哪裡設置 瀏覽:173
vb更改文件名 瀏覽:879
蘋果電腦全選文件 瀏覽:330
excel數據透視表文件 瀏覽:298
榮耀5x升級後自動重啟 瀏覽:324
css文件的代碼格式 瀏覽:152
微信61安卓永不升級版 瀏覽:800
編程入門了可以做什麼 瀏覽:658
qq飛車飛碟怎麼買2017 瀏覽:727
上海哪個地方網路最好 瀏覽:983
java數據類型干什麼的 瀏覽:840
c怎麼列印文件怎麼打開 瀏覽:217
圖片列印PDF文件中間有個白條 瀏覽:955
柔道90版本搬磚裝備 瀏覽:377
win7remixos沒網路 瀏覽:427

友情鏈接