If there is no way to create and create programs in Android applications
thanks.
Sorry, it seems that the question is not clear, explain me a little more:
- I have an activity it's A) with several scenes (for example 5 image view).
- And a normal Java class (it tells B) that is used by my activity.
- In my activity
- If a user clicks on a view (image view), then the view calls a method in OnClickListener B.
- In B, If the operation is successful, it will call again a method in the activity
- In the activity method, this will replace the image or state for the clicked image view
On the other side:
Click on View (x) in Activity -------> B.doSomething () --------> A.bIsDone () -----> Change the image to view (x)
General execution with the field, its work and no problem.
The problem is that I want to automate this process, my code looks like this:
while (! B.isFinished ()) {try {b} .doSomething (& lt; see X & gt;); Thread.Sleep (1000); } Grip (Interrupted e) e.printStackTrace (); }}
The problem is that, by the end of the loop, it will not render anything.
I tried to put a loop in another thread, but the exception to throw it:
android.view.ViewRoot $ CalledFromWrongThreadException: only the original thread that can create a visual hierarchy Touch your thoughts
What can I do for this issue? I thought that clicking on the event shows (by the code) helps, or does not help.
What is your solution? Thanks
In your activity b
, create one
handler mHandler = new handler ();
Your doSomething ()
inside b
using your ImageView MHandler.post (Runnabal R)
. How to update the UI in Runnerbase, code should be included.
The cause of the problem may be because you are trying to update using B
by using the A
thread. I think you can also use runOnUiThread (runnable r)
as well.
The original answer was edited before the question.
sending XXX
sending the event (key events) Event)
/ code> Task is Google's friend :)
The dispatch is sent from the document's document to the event.
Public Boolean Dispatches Event (Key Event Event)
Dispatch a key event in the next scene on the Focus Path, below the path view tree Currently the focused view runs. If the focus of this scene is focused, then it will transmit itself, otherwise it will pass on the focus path to the next node. This method also urges any major audience.
Comments
Post a Comment