1
I am using an external sqlite database, in the Assets folder.
I followed that model (loading-a-bank-created-externally) and I was able to access the bank.
How much testing worked normally on my Mainactivity, the problem I had was when I tried using with Fragment.
In my project I am using Ragments, and I am not able to make it work.
Part of the code that is inside a Fragment;
helper = new DatabaseHelper(getActivity(),null,1);
db = helper.getDatabase();
list = (ListView) rootView.findViewById(R.id.listalivro);
Cursor cursor = db.query("livro", campos, null, null, null, null, null);
SimpleCursorAdapter Madapter = new SimpleCursorAdapter(getActivity(),
android.R.layout.simple_list_item_1,
cursor,
new String[] {"ver_livro","ver_capitulo"},
new int[] {R.id.ver_livro,R.id.ver_capitulo }, 0);
list.setAdapter(Madapter);
list.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
Remembering that this code worked when I created a new project without Fragment, assemble everything in Mainactivity. It copies the database and opens normally. But in my project it doesn’t work.
11-23 16:17:19.053: E/trace(755): error Opening trace file: No such file or directory (2)
I’ve already made sure the bank is in the Assets folder, there’s no firewall or Antivirus blocking access. Remembering that if I use without Fragment works smoothly.
That class
DatabaseHelper
is yours or a subclass ofSQLiteOpenHelper
? Could you include her in the question?– Wakim