JHB의 프로그래밍 삽질기

[android] 안드로이드에서 사용하는 여러가지 경로들 본문

PROGRAMMING/Android/Java

[android] 안드로이드에서 사용하는 여러가지 경로들

roter 2012.07.22 06:11

public class ContextExam extends Activity{

private static final String TAG = "ContextExam";

public void onCreate(Bundle savedInstanceState){

super.onCreate(savedInstanceState);

//1. 시스템 서비스 호출

AccessibilityManager accessibilityManager =

(AccessibilityManager)this.getSystemService(Context.ACCESSIBILITY_SERVICE);

//2. Context application Pakcage에 연관된 database array return

String[] databaseList = this.databaseList();

for(String database : databaseList){

Log.i(TAG, "1. database : " + database);

}

Log.i(TAG, "2. database path : " + getDatabasePath("webview.db").getAbsolutePath());

//3. Return global application object of the current process

Context applicationContext = this.getApplicationContext();

ApplicationInfo applicationInfo = this.getApplicationInfo();

Log.i(TAG, "3. Application ClassName : " + applicationInfo.className);

Log.i(TAG, "4. Application SourceDir : " + applicationInfo.sourceDir);

Log.i(TAG, "5. Application DataDir : " + applicationInfo.dataDir);

//4. Return AssetManager instance

AssetManager assetManager = this.getAssets();

try{

String[] assetList = assetManager.list("/data/data/com.example.view");

for(String asset : assetList){

Log.i(TAG, "6. asset : " + asset);

}

}catch(IOException e){

e.printStackTrace();

}

//5. CacheDir 경로

File cacheDir = getCacheDir();

Log.i(TAG, "7. CacheDir = " + cacheDir.getAbsolutePath());

//6. PackageName

String packageName = getPackageName();

Log.i(TAG, "8. PackageName = " + packageName);

Log.i(TAG, "9. ExternalCacheDir = " + getExternalCacheDir());

Log.i(TAG, "10. ExternalFilesDir = " + getExternalFilesDir(null));

Log.i(TAG, "11. FilesDir = " + getFilesDir());

Log.i(TAG, "12. PackageResourcePath = " + getPackageResourcePath());

String stringName = getResources().getString(R.string.app_name);

Log.i(TAG, "13. R.string.app_name = " + stringName);

Log.i(TAG, "14. R.string.app_name = " + this.getString(R.string.app_name));

Log.i(TAG, "15. isRestricted = " + isRestricted());

//sendBroadcast();

//startActivity();

//startService();

//registerReceiver();

Log.i(TAG, "16. PackageCodePath = " + getPackageCodePath());

}

}

 

위와 같다.

참고로 cocos2d-x에서 getWritablePath로 얻어올때의 경로는 DataDir의 경로와 일치한다.

 

위의 자료는 http://blog.daum.net/mellowwind/10853723 에서 퍼옴.

저작자 표시 비영리 변경 금지
신고
0 Comments
댓글쓰기 폼