ArrayList<MyClass> myList = new ArrayList<MyClass>();
ListView listView = (ListView) findViewById(R.id.list);
ArrayAdapter<MyClass> adapter = new ArrayAdapter<MyClass>(this, R.layout.row,
to, myList.);
listView.setAdapter(adapter);
Class: MyClass
class MyClass {
public String reason;
public long long_val;
}
I have created row.xml in layouts, but don’t know how to show both reason and long_val in the ListView using ArrayAdapter.
Implement custom adapter for your class:
For those not very familiar with the Android framework, this is explained in better detail here: https://github.com/codepath/android_guides/wiki/Using-an-ArrayAdapter-with-ListView.