現在、ArrayAdapter に問題があります...「コンストラクター ArrayAdapter(VideoPlay.ShowTitlesTask, int, int, ArrayList) が定義されていません」というエラーが表示されます。私は何を間違っていますか?
問題はクラス ShowTitlesTask にあります
package com.aer.illbehonest;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.concurrent.ExecutionException;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import net.sf.json.JSONSerializer;
import org.apache.commons.io.IOUtils;
import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class VideoPlay extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video_play);
new ShowTitlesTask().execute("");
}
class ShowTitlesTask extends AsyncTask<String, Void, ArrayList<String>> {
ArrayList<String> titlesList;
@Override
protected ArrayList<String> doInBackground(String... args) {
URL jsonURL = null;
try {
jsonURL = new URL("http://gdata.youtube.com/feeds/api/users/illbehonest/uploads?v=2&alt=jsonc");
} catch (MalformedURLException e3) {
e3.printStackTrace();
}
URLConnection jc = null;
try {
jc = jsonURL.openConnection();
} catch (IOException e2) {
e2.printStackTrace();
}
InputStream is = null;
try {
is = jc.getInputStream();
} catch (IOException e1) {
e1.printStackTrace();
}
String jsonTxt = null;
try {
jsonTxt = IOUtils.toString(is);
} catch (IOException e) {
e.printStackTrace();
}
JSONObject json = (JSONObject) JSONSerializer.toJSON(jsonTxt);
JSONObject jdata = json.getJSONObject("data");
JSONArray jentry = jdata.getJSONArray("items");
for (int entryNumber = 0; entryNumber<=25; entryNumber++){
JSONObject entry = jentry.getJSONObject(entryNumber);
titlesList.add(entry.getString("title"));
}
return titlesList;
}
protected void onPostExecute(ArrayList<String> result) {
ListView listView = (ListView)VideoPlay.this.findViewById(R.id.videolist);
ArrayAdapter<String> adapter = new ArrayAdapter<String> (this,
android.R.layout.simple_list_item_1, android.R.id.text1, titlesList);
titlesList.setAdapter(arrayAdapter);
}
}
}