yatsek / microemu

Automatically exported from code.google.com/p/microemu
0 stars 0 forks source link

Set label bug on textfield. #90

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.Attempting to set the label on textfield from a running thread. other than 
through posting it.
2. Any 
3.

What is the expected output? What do you see instead?
output should be a change in the label of the textfield. Error is thrown.
V/MicroEmulator(  188): android.view.ViewRoot$CalledFromWrongThreadException: 
Only the original thread that created a view hierarchy can touch its views.
V/MicroEmulator(  188):       
V/MicroEmulator(  188): sin item state changed
V/MicroEmulator(  188):       
V/MicroEmulator(  188): .   at 
android.view.ViewRoot.checkThread(ViewRoot.java:2682)

What version of the product are you using? On what operating system?
Version 3, on linux

Please provide any additional information below.
The problem should be solved by the method listed below.

public void setLabel(String label) {
        labelView.setText(label);
    }
Should resembly the method below, then it is handled by android, it is 
definately a design floor, cause it is a mess to have to do things like this. 
But android is a mess in general.

public void setString(final String text) {
        activity.post(new Runnable() {
            public void run() {
                editView.setText(text);
            }
        });
    }

Original issue reported on code.google.com by richard....@googlemail.com on 6 Jan 2011 at 12:20

GoogleCodeExporter commented 8 years ago
Fixed in trunk

Original comment by bar...@gmail.com on 6 Jan 2011 at 11:55