Hello!
I'm developing an app that it throws an error when I try to assign a value to a textview. The structure is this:
When I execute it, it gives me this error:
WARN/System.err(733): android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. (it refers to the underlined line)
Why can't I set a value to that textview although it is declared as public???
I've tried creating another instance of it inside the update function but also crashes with the same error at the same line.
Where is the problem? Thanks!!
I'm developing an app that it throws an error when I try to assign a value to a textview. The structure is this:
Code:
main class{
public Textview mytv;
onCreate{
mytv = (TextView) findViewById(R.id.Time);
mytv.setText("some text");
}
public update(){
[U]mytv.setText("something");[/U]
}
}
When I execute it, it gives me this error:
WARN/System.err(733): android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. (it refers to the underlined line)
Why can't I set a value to that textview although it is declared as public???
I've tried creating another instance of it inside the update function but also crashes with the same error at the same line.
Where is the problem? Thanks!!