2012-10-29 103 views
1

我是android编程新手,现在正在使用SQLite数据库。我有一个简单的示例,并创建代码:在android文件资源管理器中看不到数据库

public TimeTrackerOpenHelper(Context context) { 
    super(context, "timetracker.db", null, 1); 

} 

@Override 
public void onCreate(SQLiteDatabase db) { 


} 

@Override 
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { 


} 

,并在我的活动类onCreate方法我创建一个openHelper为TimeTrackerOpenHelper:

TimeTrackerOpenHelper openHelpler = new TimeTrackerOpenHelper(this); 

我运行的代码,并打开文件浏览器以下路径数据/数据/但我无法看到数据库文件夹。为什么没有显示?

+0

其中是在onCreate(SQLiteDatabase数据库)查询? –

+0

您需要添加db.execSQl(“create table ...”);在onCreate()方法 –

+0

我创建了数据库。我认为创建表对于查看数据库文件并不重要。但是我试图按照你的说法创建桌子。什么也没有变。我仍然无法看到数据库。即使我用过AVD。 –

回答

1
I'm running the code and opening the file explorer following the path data/data/ but i can't see databases folder. why it isn't showed? 

如果您在设备测试,那么你不能看到DB文件,因为安全,除非你的设备是植根。

如果你想看到你的数据库文件。你可以使用ADV

+0

找到它感谢。 –

相关问题