Get database path

后端 未结 4 846
我在风中等你
我在风中等你 2020-12-10 00:57

Im new to android and I want to create kind of CRUD with SQLite.

I have a public class DataBaseHelper which have a constructor:

public D         


        
4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-10 01:27

    I needed to access dbs for the app also. This worked for me:

    String dbFile;
    String[] dbNames = getSherlockActivity().databaseList(); // or ContextWrapper
    for (int i = 0; i < dbNames.length; i++) {
        dbFile = getSherlockActivity().getDatabasePath(dbNames[i]).toString();
        Log.i(LOG_TAG, dbFile);
    }
    

    Hope it helps! :-)

提交回复
热议问题