I'm trying to get my first Android plugin to work. I've successfully registered it and able to execute it. Inside of my plugin execute action, I am trying to do the following:
ctx.setContentView(R.layout.map);
Which contains a new layout to load google maps; however, when I run this I receive the following error:
Only the original thread that created a view hierarchy can touch its views.
Any idea how I should go about doing this?
You have to run it on UI thread. You can touch UI elements only on UI thread.
runOnUiThread(runb);
private Runnable runb = new Runnable() {
public void run(){
//call setContentView code here.
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With