protected Void doInBackground(Void... params) {
details = new ArrayList<Details>();
jsonobject = JSONfunctions
.getJSONfromURL(url);
try {
// Locate the NodeList name
jsonarray = jsonobject.getJSONArray("results");
for (int i = 0; i < jsonarray.length(); i++) {
jsonobject = jsonarray.getJSONObject(i);
Details detailAll = new Details();
detailAll.setResType(jsonobject.optString("resType"));
detailAll.setName(jsonobject.optString("resName"));
detailAll.setUrl(jsonobject.optString("resLink"));
details.add(detailAll);
}
} catch (Exception e) {
Log.e("Error", e.getMessage());
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void args) {
Till now I am parsing JSON object in the spinner, I want to show them in Horizontal scroll view.Means strings will be shown in text views, not in spinner
Thanks
// TextView textView = (TextView) findViewById(R.id.textView);
MaterialSpinner mySpinner = (MaterialSpinner) findViewById(R.id.spin);
mySpinner.setHint("My liked video is ");
nameList = new ArrayList<String>();
for (Details bean : details) {
nameList.add(bean.getResType());
}
ArrayAdapter<String> adapter = new ArrayAdapter<String>(DetailsActivity.this,
android.R.layout.simple_spinner_item, nameList);
adapter
.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mySpinner.setAdapter(adapter);
}