このasynctaskはさまざまなアクティビティを開始するために使用したいので、開始したいクラスをパラメーターとして送信したいと思います。
例:
.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
new taskIntent().execute(**example1.class**);
}
}
.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
new taskIntent().execute(**example2.class**);
}
}
private class taskIntent extends AsyncTask<String, Integer, Void> {
ProgressDialog dialog;
@Override
protected Void doInBackground(String... params) {
return null;
}
@Override
protected void onPreExecute() {
dialog = ProgressDialog.show(Calendar.this, "",
"Loading...", true);
dialog.show();
}
protected void onPostExecute(Void unused){
Intent intent = new Intent(Calendar.this, **parameter[0]**);
startActivity(intent);
finish();
dialog.dismiss();
}
}
クラスをパラメーターとして送信してインテントで使用するにはどうすればよいですか?
ありがとう、私の下手な英語でごめんなさい