doInBackGround メソッドの AsyncTask クラスにエラーがあります。
デバッグから、プログラムが DoInbackGround メソッドに入っていないと確信しています。その前、呼び出し中、またはコンテキストまたはアクティビティの受け渡しに問題があります
エラーログ :
FATAL EXCEPTION: AsyncTask #3
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:299)
at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
at android.app.SharedPreferencesImpl.getInt(SharedPreferencesImpl.java:221)
at com.app.sams.GetStudentsListAsync.doInBackground(GetStudentsListAsync.java:88)
at com.app.sams.GetStudentsListAsync.doInBackground(GetStudentsListAsync.java:1)
at android.os.AsyncTask$2.call(AsyncTask.java:287)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
... 5 more
AsyncTask の呼び出し
private final List<Teacher> ClassList;
private final Activity activity;
Context context;
public TeacherAdapter(Activity activity, List<Teacher> ClassList,
Context context) {
super(activity, R.layout.activity_list, ClassList);
this.activity = activity;
this.context = context;
this.ClassList = ClassList;
}
holder.Button1.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Toast toast = Toast.makeText(context, ClassList.get(position)
.getName(), Toast.LENGTH_LONG);
toast.show();
GetStudentsListAsync asynTask = new GetStudentsListAsync(
activity, context);
asynTask.execute();
}
});
AsyncTask クラス:
private Activity activity;
//private ProgressDialog progressDialog;
Context context;
public GetStudentsListAsync(Activity activity, Context context) {
super();
//this.progressDialog = progressDialog;
this.activity = activity;
this.context = context;
}
次にDoInBackGroundですが、上記のルートに問題があると確信しています。