I am working on putting string array into list view.When I do this I got an error
Error:(127, 47) error: no suitable constructor found for ArrayAdapter(PrimaryActivity.FetchWebsiteData,int,Void)
constructor ArrayAdapter.ArrayAdapter(Context,int,int) is not applicable
(argument mismatch; PrimaryActivity.FetchWebsiteData cannot be converted to
Context)constructor ArrayAdapter.ArrayAdapter(Context,int,String[]) is not applicable(argument mismatch; PrimaryActivity.FetchWebsiteData cannot be converted to Context)constructor ArrayAdapter.ArrayAdapter(Context,int,List<String>) is not applicable
(argument mismatch; PrimaryActivity.FetchWebsiteData cannot be converted to Context)
My java code is
protected Void doInBackground(Void... params) {
ArrayList<String> hrefs=new ArrayList<String>();
try {
// Connect to website
} catch (IOException e) {
e.printStackTrace();
}
//parsing first URL
try {
//listValue=colValue.text();
String subString=colValue.text();
String[] result=subString.split("(?<=[a-z])\\.(?=\\s*[A-Z])|[,:]");
//expose all array values
//listValue=result[1];
/*
for(int i=0;i<result.length;i++) {
listValue=result[0];
}*/
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
all I want to do that String array named resultto list view while I doing the value to list view using an array adapter be like this
protected void onPostExecute(Void result) {
ListView list=(ListView)findViewById(R.id.listShow);
ArrayAdapter<String> arrayAdapter=new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, result);
list.setAdapter(arrayAdapter);
mProgressDialog.dismiss();
}
How to solve the error and how to get the value of string array into that list view I mentioned.