안드로이드 개발 질문/답변
(글 수 45,052)
db 저장 경로가 변경 가능한지와
서로 다른 activity(패키지는 같은) 가 하나의 db를 사용할 수 있는지 궁금합니다.
A라는 액티비티는 데이터를 관리하고
B라는 액티비티는 데이터 및 파일을 추가하고 자신(B activity)은 삭제되는 상황입니다.
SQLiteDatabase.openOrCreateDatabase(String path, SQLiteDatabase.CursorFactory factory)
SQLiteDatabase.openDatabase(String path, SQLiteDatabase.CursorFactory factory, int flags)
를 사용해 봤지만 unable to open databse file 란 메시지만 나옵니다.
방법이 없을까요?
ContentResolver
interface. A content provider is only required if you need to share data between multiple applications. For example, the contacts data is used by multiple applications and must be stored in a content provider. If you don't need to share data amongst multiple applications you can use a database directly viaSQLiteDatabase
.말씀하신 액티비티가 다른 app 이면 Content provider 만드시구요.
한 app면 디비 함수만으로도 가능 하겠네요.