2017-09-07 3 views
1

自分のアプリケーションのパッケージ名を表示するアプリケーションを作成しています実際のデバイスでは動作していませんが、私がこのアプリケーションをエミュレータで実行しているときは、DDMSで自分のデータベースを見ることができます。誰もがmenifestファイルで 他のアプリケーション(whatspp、shareitなど)のようなすべてのデバイスのAndroid/dataフォルダにアプリケーションのパッケージ名フォルダを表示する方法

アンドロイド/データ/ com.app.testing /データベース

内の私のデータベース名を表示する方法を私を助けることができる、私はこの

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> 

を使用していましたあなたが知っていれば私のdatabasehelperのクラッセ

private static final int DATABASE_VERSION = 1; 

// Database Name 
private static final String DATABASE_NAME = "contactsManager"; 

// Contacts table name 
private static final String TABLE_CONTACTS = "contacts"; 

// Contacts Table Columns names 
private static final String KEY_ID = "id"; 
private static final String KEY_NAME = "name"; 
private static final String KEY_PH_NO = "phone_number"; 

public DatabaseHandler(Context context) { 
    super(context, DATABASE_NAME, null, DATABASE_VERSION); 
//  Log.e("TAG", "DatabaseHandler: "+context.getDatabasePath(DATABASE_NAME).getPath()); 
    File dbFile = context.getDatabasePath(DATABASE_NAME); 
    Log.e("TAG", "DatabaseHandler: "+dbFile.getAbsolutePath()); 
} 

に事前にありがとう、私を助けてくださいこれについて..........

iは enter image description here

答えて

2

は、以下のようなアプリケーションパッケージ名のディレクトリを作成してみてください。

String extStorageDirectory = Environment.getExternalStorageDirectory().toString()+ "/Android/data/com.app.testing/database"; 
    File dir = new File(extStorageDirectory); 
    if(!dir.exists()) 
     dir.mkdirs(); 

    File sqliteFile = new File(dir, fileName); // your sqlite file name like "myDb.sqlite" 

    try{ 
     sqliteFile.createNewFile(); 
    }catch (IOException e){ 
     e.printStackTrace(); 
    } 
0

)は(この関数getPackageNameを使用してみてください画像の下のように自分のアプリケーションのパッケージ名を作成したいです。

0

この

File dir = new File("Android/data/your location"); // define your folder location 
try{ 
    if(dir.mkdir()) { 
    System.out.println("Directory created"); 
    } else { 
    System.out.println("Directory is not created"); 
    } 
}catch(Exception e){ 
    e.printStackTrace(); 
} 
関連する問題