엑셀을 sqlite로 변경한 후 assets폴더에 넣었습니다.
public static void DBcopy(Resources _res, String db_name)
{
String dir="data/data/주소/";
File folder = new File(dir+"assets");
folder.mkdirs();
File outfile = new File(dir+"assets/"+db_name);
if(outfile.length() <= 0)
{
AssetManager assetManager = _res.getAssets();
try
{
InputStream is = assetManager.open(db_name, AssetManager.ACCESS_BUFFER);
long filesize = is.available();
byte[] tempdata = new byte[(int)filesize];
is.read(tempdata);
is.close();
outfile.createNewFile();
FileOutputStream fo = new FileOutputStream(outfile);
fo.write(tempdata);
fo.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
private void db() {
// TODO Auto-generated method stub
String db_name= "aaa.sqlite"; //sqlite 이름
String db_table_name= "aaa"; //table 이름
SQLiteDatabase myDB;
Cursor allRCD;
DBcopy(getResources(), db_name);
myDB = getApplicationContext().openOrCreateDatabase(db_name, 0, null);
allRCD = myDB.query(db_table_name, null, null, null, null, null, null);
myDB.close();
}
sqlite 이름과 table이름이 같아서 그런걸까 하고 수정해봤지만 결과는 같았구요
sqlite에 내용이 들어가있는것도 확인했어요 이름을 잘못썼을까 몇번 확인했는데 결과는 같네요..ㅠ
아 그리고 no such table 나오기전에
SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length 이런 에러가 두개떠있는데 혹시 이것때문인가요?