마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

GSON 사용중 fromJson 질문드립니다.

0 추천

gson을 이용해서 pendingintent 를 sharedPreferences 에 저장하는 작업을 하고 있는데요.

빨간색글씨 위치 : 120 : pendingIntent = gson.fromJson(json,PendingIntent.class); 이 구문에서 자꾸 에러가 납니다.

TypeToken 을 지정해줘야될것같은데요. 여러가지 해봤는데 전부 안되네요.. 몇시간째 이러고있는지 모르겠습니다. 제발 알려주세요 ㅠㅠ

Error : Unable to start service org.jsb.busgod.busgod.LocationService@412cfe38 with Intent { cmp=org.jsb.busgod.busgod/.LocationService (has extras) }: java.lang.RuntimeException: Unable to invoke no-args constructor for interface android.content.IIntentSender. Register an InstanceCreator with Gson for this type may fix this problem.

Caused by: java.lang.RuntimeException: Unable to invoke no-args constructor for interface android.content.IIntentSender. Register an InstanceCreator with Gson for this type may fix this problem.

Caused by: java.lang.reflect.InvocationTargetException

Caused by: java.lang.InstantiationException: can't instantiate class android.content.IIntentSender; abstract class or interface

at org.jsb.busgod.busgod.LocationService.deleteLocation(LocationService.java:120)
at org.jsb.busgod.busgod.LocationService.onStartCommand(LocationService.java:82)
우랴 (3,680 포인트) 님이 2014년 7월 2일 질문

1개의 답변

0 추천
can't instantiate class 라고 나오는거보니 뭔가 따로 초기화를 해주는 코드가 필요한게 아닌가 싶네요
쎄미 (162,410 포인트) 님이 2014년 7월 3일 답변
...