I found this here how to use the runOnUiThreaed method, but I don't understand how to use it.
I am setting up a list adapter in my main action
// Set a gobal reference to the list adapter and the list respectivly ListAdapter listAdapter; static ArrayList<String> list; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // some code adapter = new ListAdapter(getActivity(), R.layout.item_layout, list); listView.setAdapter(adapter); // some code }
I have a list adapter that calls a service handler class
public class ListAdapter {
Here is the .run() method in the ServiceHandler class, where I updated the list and list adapter
public void run(Adapter listAdapter, ArrayList<String> list){
But I get this runtime error
Only the source stream that created the view hierarchy can touch its views.
So I am trying to solve the error with .runOnUiThread
So here is the .run() method in the ServiceHandler class, with runOnUiThread
public void run(Adapter listAdapter, ArrayList<String> list){
But I get
Unable to resolve 'runOnUiThread (anonymous Java.lang.runnable)' method
android listview
the_prole
source share