2010年10月23日土曜日

Android log file output

android.osパッケージ - Environmentクラスを使用します。


# Environment.getXXXDirectory()を呼び出すと、任意のパス情報を保持したFileインスタンスを取得できます。



サンプルソースコード

File file = null;

file = Environment.getDataDirectory();
Log.v("data", file.getPath()); // 出力結果は、「/data」

file = Environment.getDownloadCacheDirectory();
Log.v("download cache", file.getPath()); // 出力結果は、「/cache」

file = Environment.getExternalStorageDirectory();
Log.v("storage", file.getPath()); // 出力結果は、「/sdcard」

file = Environment.getRootDirectory();
Log.v("root", file.getPath()); // 出力結果は、「/system」

0 件のコメント:

コメントを投稿