Android Question Threading Libary Problems...

DennisW

Member
Licensed User
Longtime User
Hi,

Im having a lot of trouble with the Threading Libary...

I have build up a background Task like descriped in the example in this zip, but it only runs sometimes...

Mostly there are different Errors, with the same code....

Often its this one: "Java.Lang.runtimeexception: can't create handler inside thread that has not called looper.prepare()"

Sometimes it is: "Exception: Only the original thread that created a view hierarchy can touch its views."

Im using the following Code.... it also has worked a couple times... but than it crashes again and again...

Is there someone who can fix this? :)

B4X:
Dim myThread As Thread
Dim Lock1 As Lock
....
Sub Activity_Create()
If myThread.IsInitialized =False Then
myThread.Initialise("myThread")
End If
End Sub
...

myThread.Name = "BackThread1"
Dim args(0) As Object
Lock1.Initialize(True)
myThread.Start(Null, "SavePhone", args)
 
Top