[Solved] Set Text edittext activity from another class android


You can only manipulate UI elements, when your code is executed on the UI thread.

class EventHandler implements RfidEventsListener {
    // Read Event Notification
    public void eventReadNotify(RfidReadEvents e){
        TagData[] myTags = myReader.Actions.getReadTags(100);
        if (myTags != null)
        {
            for (int index = 0; index < myTags.length; index++)
            {
                System.out.println("Tag ID " + myTags[index].getTagID());

                //I want to settext here
                final String myText = myTags[index].getTagID();
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        myEditText.setText(myText);
                    }
                });

            }
        }
    }
    // Status Event Notification
    public void eventStatusNotify(RfidStatusEvents e) {
        System.out.println("Status Notification: " + 
        e.StatusEventData.getStatusEventType());
    }
}

solved Set Text edittext activity from another class android