編輯:關於Android編程
在android手機上存儲文件是我們每個手機用戶必不可少的功能,而對於開發者而言,熟練的操作各個文件,這樣對於我們開發有很大幫助,下面androidkaifa.com就介紹一個android API文件為我們提供的那些獲取文件路徑的方法,它們所對應的實際文件路徑是哪個文件,好了廢話不多說,直接上代碼!
package com.herongyang;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.ScrollView;
import android.os.Environment;
public class AboutAndroid extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String msg = "";
msg += "System properties\n";
msg += "-------------\n";
java.util.Properties props = System.getProperties();
java.util.Enumeration e = props.propertyNames();
while (e.hasMoreElements()) {
String k = (String) e.nextElement();
String v = props.getProperty(k);
msg += k+": "+v+"\n";
}
msg += "\n";
msg += "Envirionment variables\n";
msg += "-------------\n";
java.util.Map envs = System.getenv();
java.util.Set keys = envs.keySet();
java.util.Iterator i = keys.iterator();
while (i.hasNext()) {
String k = (String) i.next();
String v = (String) envs.get(k);
msg += k+": "+v+"\n";
}
msg += "\n";
msg += "Environment folders\n";
msg += "-------------\n";
msg += "Data folder: "+Environment.getDataDirectory().getPath()+"\n";
msg += "Download cache folder: " +Environment.getDownloadCacheDirectory().getPath()+"\n";
msg += "External Storage folder: " +Environment.getExternalStorageDirectory().getPath()+"\n";
msg += "Root folder: " +Environment.getRootDirectory().getPath()+"\n";
msg += "\n";
msg += "Application context info\n";
msg += "-------------\n";
msg += "Cache folder: "+getCacheDir().getPath()+"\n";
msg += "External cache folder: "+getExternalCacheDir().getPath()+"\n";
msg += "File folder: " +getFilesDir().getPath()+"\n";
msg += "OBB folder: "+getObbDir().getPath()+"\n";
msg += "Package name: " +getPackageName()+"\n";
msg += "Package code path: " +getPackageCodePath()+"\n";
msg += "Package resource path: "+getPackageResourcePath()+"\n";
TextView tv = new TextView(this);
tv.setText(msg);
ScrollView sv = new ScrollView(this);
sv.addView(tv);
setContentView(sv);
}
}
運行應用程序我們可以得到如下信息::
Data folder: /data
Download cache folder: /cache
External storage folder: /mnt/sdcard
Root folder: /system www.2cto.com
Cache folder: /data/data/com.herongyang/cache
External cache folder: /mnt/sdcard/Android/data/com.herongyang/cache
File folder: /data/data/com.herongyang/files
OBB folder: /mnt/sdcard/Android/obb/com.herongyang
Package name: com.herongyang
Package code path: /data/app/com.herongyang-1.apk
Package resource path: /data/app/com.herongyang-1.apk
如果是自己開發的板子,需要用GPIO引腳控制3G模塊開機/關機時,下面的文章會對你有所幫助,是以處理器IMX6和中興MG3732模塊為例介紹。 一、引腳連接
ExpandableListView簡介ExpandableListView是ListView的子類,用法和ListView類似,ExpandableListView可以
在這篇文章中,我將介紹如何實現列表中的視頻播放。在流行的應用,如Facebook,Instagram的或Magisto的工作原理相同:Facebook的:Ma
自定義圓形ImageView圓形ImageView在頭像顯示用的比較普遍了,今天對於實現圓形ImageView做個總結;主要思路是 重寫 onDraw() ;方法有兩個: