안드로이드 개발 질문/답변
(글 수 45,052)
텝호스트로 다음의 클래스를 연결했습니다
tabhost.addTab(tabhost.newTabSpec("tab1").setIndicator("HISTORY").setContent(new Intent(this, history.class)));
tabhost.addTab(tabhost.newTabSpec("tab2").setIndicator("SCAN").setContent(new Intent(this, cameratest.class)));
tabhost.addTab(tabhost.newTabSpec("tab3").setIndicator("LASTVIEW").setContent(new Intent(this, eye_view_main.class)));
그중 history 는 리스트뷰 클래스를 새로 만들었구요
cameratest 는 사진촬영을 합니다
eye_view_main 은 웹뷰 클래스 입니다 .
문제는 DB 를 생성하는데 있습니다 .
cameratest 에서 촬영한 사진이름을 DB 에 넣어야 해서 DB 를 생성한 클래스에 넣어 주어야 하는데
cameratest 에는 context가 없습니다 .
getApplicationContext() 를 써보았는데 .
04-09 17:35:14.896: ERROR/AndroidRuntime(5185): Uncaught handler: thread main exiting due to uncaught exception
04-09 17:35:14.896: ERROR/AndroidRuntime(5185): java.lang.NullPointerException
04-09 17:35:14.896: ERROR/AndroidRuntime(5185): at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:98)
04-09 17:35:14.896: ERROR/AndroidRuntime(5185): at cont.eye.db_adapter.open(db_adapter.java:74)
이런에러가 나는군요 ㅠ_ㅠ
컨텍스트가 없기때문인거 같은데 .
어떻게 해야 주고 받을수 있을까요 ㅠ+ㅠ
tabhost.addTab(tabhost.newTabSpec("tab1").setIndicator("HISTORY").setContent(new Intent(this, history.class)));
tabhost.addTab(tabhost.newTabSpec("tab2").setIndicator("SCAN").setContent(new Intent(this, cameratest.class)));
tabhost.addTab(tabhost.newTabSpec("tab3").setIndicator("LASTVIEW").setContent(new Intent(this, eye_view_main.class)));
그중 history 는 리스트뷰 클래스를 새로 만들었구요
cameratest 는 사진촬영을 합니다
eye_view_main 은 웹뷰 클래스 입니다 .
문제는 DB 를 생성하는데 있습니다 .
cameratest 에서 촬영한 사진이름을 DB 에 넣어야 해서 DB 를 생성한 클래스에 넣어 주어야 하는데
cameratest 에는 context가 없습니다 .
getApplicationContext() 를 써보았는데 .
04-09 17:35:14.896: ERROR/AndroidRuntime(5185): Uncaught handler: thread main exiting due to uncaught exception
04-09 17:35:14.896: ERROR/AndroidRuntime(5185): java.lang.NullPointerException
04-09 17:35:14.896: ERROR/AndroidRuntime(5185): at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:98)
04-09 17:35:14.896: ERROR/AndroidRuntime(5185): at cont.eye.db_adapter.open(db_adapter.java:74)
이런에러가 나는군요 ㅠ_ㅠ
컨텍스트가 없기때문인거 같은데 .
어떻게 해야 주고 받을수 있을까요 ㅠ+ㅠ



