Android Question using ResumableSub inside sub using wait for

azzam223

Active Member
Licensed User
Longtime User
Assalam alaikum

I try to using
ResumableSub inside another

B4X:
sub load
wait for(loaddata)Complete(lst as list)
end sub
sub loaddata as ResumableSub
dim cmd as dbcommand
cmd.initialize
cmd.name="loaddata"
dim j as httpjob=connect.ExecuteQuery(cmd,0,null)
wait for(j) jobdone(j as httpjob)
if success then
dim lst as list
lst.initialize
return lst
end if
end sub

but j.success is not reached what is the problem when I use the loaddata without ResumableSub is working
 

azzam223

Active Member
Licensed User
Longtime User
B4X:
Sub btnLogin_Click
    Dim ct As Cities
    ct.Initialize
Wait For    (ct.Loaddata) Complete(lstcity As List)
Msgbox(lstcity.Size,"")   
End Sub

B4X:
Public Sub Loaddata As ResumableSub
    Database.InitialConnection
    Dim lst As List
    lst.Initialize
    Dim cmd As DBCommand=Database.CreateCommand("GetAllCities",Array As Object())
    Wait For (Database.Connect.ExecuteQuery(cmd,0,Null)) JobDone(js As HttpJob)
If js.Success Then
        Dim res As DBResult=Database.GetResult(js)
    For Each obj() As Object In res.Rows
        Dim ct As Cities
    ct.Initialize
    ct.Ctid=obj(0)
    ct.ctname=obj(1)
    ct.CTEnglishname=obj(2)
    Wait For (ct.GetStreets) complete(lst As List)
    ct.lstStreets=lst
    lst.Add (ct)
    Next
        Return lst
End If
Return Null
End Sub

the logs
B4X:
>>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix.
CheckJNI is ON
Trying to load lib libjavacore.so 0x0
Added shared lib libjavacore.so 0x0
Trying to load lib libnativehelper.so 0x0
Added shared lib libnativehelper.so 0x0
No JNI_OnLoad found in libnativehelper.so 0x0, skipping init
Note: class Landroid/app/ActivityManagerNative; has 179 unimplemented (abstract) methods
Couldn't load memtrack module (No such file or directory)
failed to load memtrack module: -2
Calling main entry com.android.commands.am.Am
START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=Lamha.mole/.main} from pid 3106
GC_FOR_ALLOC freed 506K, 20% free 7285K/9036K, paused 6ms, total 6ms
Shutting down VM
GC_CONCURRENT freed 94K, 15% free 576K/672K, paused 0ms+0ms, total 0ms
eglMakeCurrent: 0xb9451e20: ver 2 0
Start proc Lamha.mole for activity Lamha.mole/.main: pid=3117 uid=10052 gids={50052, 3003, 1028, 1015}
Starting remote logger. Port: 31863
eglMakeCurrent: 0xb9451e20: ver 2 0
gralloc_alloc: Creating ashmem region of size 11796480
HostConnection::get() New Host Connection established 0xb940adb0, tid 3117
Unrecognized GLES max version string in extensions: ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_dma_v1
eglCreateContext: 0xb940aed0: maj 2 min 0 rcv 2
gralloc_alloc: Creating ashmem region of size 11796480
eglMakeCurrent: 0xb940aed0: ver 2 0
tid 3117: eglSurfaceAttrib(1199): error 0x3009 (EGL_BAD_MATCH)
Backbuffer cannot be preserved
Enabling debug mode 0
GC_CONCURRENT freed 96K, 7% free 3183K/3388K, paused 3ms+0ms, total 5ms
*** Debugger waiting for connection (0) ***
eglMakeCurrent: 0xb9451e20: ver 2 0
Displayed Lamha.mole/.main: +344ms
gralloc_alloc: Creating ashmem region of size 192512
*** Debugger waiting for connection (1) ***
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
GC_CONCURRENT freed 119K, 7% free 3447K/3676K, paused 1ms+0ms, total 3ms
GC_FOR_ALLOC freed 101K, 6% free 3540K/3752K, paused 1ms, total 1ms
Grow heap (frag case) to 4.144MB for 614412-byte allocation
GC_CONCURRENT freed <1K, 5% free 4140K/4356K, paused 1ms+0ms, total 3ms
** Activity (main) Resume **
error loading /system/media/audio/ui/Effect_Tick.ogg
Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
error loading /system/media/audio/ui/Effect_Tick.ogg
Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
error loading /system/media/audio/ui/Effect_Tick.ogg
Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
error loading /system/media/audio/ui/Effect_Tick.ogg
Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
error loading /system/media/audio/ui/Effect_Tick.ogg
Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
error loading /system/media/audio/ui/KeypressStandard.ogg
Soundpool could not load file: /system/media/audio/ui/KeypressStandard.ogg
error loading /system/media/audio/ui/KeypressSpacebar.ogg
Soundpool could not load file: /system/media/audio/ui/KeypressSpacebar.ogg
error loading /system/media/audio/ui/KeypressDelete.ogg
Soundpool could not load file: /system/media/audio/ui/KeypressDelete.ogg
error loading /system/media/audio/ui/KeypressReturn.ogg
Soundpool could not load file: /system/media/audio/ui/KeypressReturn.ogg
error loading /system/media/audio/ui/KeypressInvalid.ogg
Soundpool could not load file: /system/media/audio/ui/KeypressInvalid.ogg
onLoadSoundEffects(), Error -1 while loading samples
GC_CONCURRENT freed 202K, 7% free 4379K/4660K, paused 1ms+0ms, total 6ms
*** Service (httputils2service) Create ***
** Service (httputils2service) Start **
VFY: unable to find class referenced in signature (Ljava/nio/file/Path;)
VFY: unable to find class referenced in signature ([Ljava/nio/file/OpenOption;)
Could not find method java.nio.file.Files.newOutputStream, referenced from method okio.Okio.sink
VFY: unable to resolve static method 16278: Ljava/nio/file/Files;.newOutputStream (Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Ljava/io/OutputStream;
VFY: replacing opcode 0x71 at 0x0012
VFY: unable to find class referenced in signature (Ljava/nio/file/Path;)
VFY: unable to find class referenced in signature ([Ljava/nio/file/OpenOption;)
Could not find method java.nio.file.Files.newInputStream, referenced from method okio.Okio.source
VFY: unable to resolve static method 16277: Ljava/nio/file/Files;.newInputStream (Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Ljava/io/InputStream;
VFY: replacing opcode 0x71 at 0x0012
GC_CONCURRENT freed 253K, 8% free 4536K/4896K, paused 0ms+2ms, total 5ms
GC_FOR_ALLOC freed 59K, 7% free 4755K/5076K, paused 2ms, total 3ms
Grow heap (frag case) to 5.820MB for 1127532-byte allocation
GC_FOR_ALLOC freed 1K, 6% free 5855K/6180K, paused 4ms, total 4ms
GC_CONCURRENT freed <1K, 6% free 5869K/6180K, paused 2ms+2ms, total 6ms
eglMakeCurrent: 0xb940aed0: ver 2 0
tid 3117: eglSurfaceAttrib(1199): error 0x3009 (EGL_BAD_MATCH)
Backbuffer cannot be preserved
eglMakeCurrent: 0xb940aed0: ver 2 0
eglMakeCurrent: 0xb940aed0: ver 2 0
Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@a51b2610 attribute=null, token = android.os.BinderProxy@a5161580
eglMakeCurrent: 0xb940aed0: ver 2 0
gralloc_alloc: Creating ashmem region of size 634880
GC_FOR_ALLOC freed 1077K, 23% free 6962K/9036K, paused 5ms, total 5ms
VM exiting with result code 0, cleanup skipped.
channel 'a529e338 Lamha.mole/Lamha.mole.main (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
channel 'a529e338 Lamha.mole/Lamha.mole.main (server)' ~ Channel is unrecoverably broken and will be disposed!
channel 'a529de88 Lamha.mole/Lamha.mole.main (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
channel 'a529de88 Lamha.mole/Lamha.mole.main (server)' ~ Channel is unrecoverably broken and will be disposed!
GC_CONCURRENT freed 217K, 15% free 7716K/9036K, paused 1ms+3ms, total 10ms
Attempted to unregister already unregistered input channel 'a529de88 Lamha.mole/Lamha.mole.main (server)'
Attempted to unregister already unregistered input channel 'a529e338 Lamha.mole/Lamha.mole.main (server)'
Process Lamha.mole (pid 3117) has died.
WIN DEATH: Window{a529de88 u0 Lamha.mole/Lamha.mole.main}
WIN DEATH: Window{a529e338 u0 Lamha.mole/Lamha.mole.main}
eglMakeCurrent: 0xb9451e20: ver 2 0
eglMakeCurrent: 0xb9451e20: ver 2 0
tid 1704: eglSurfaceAttrib(1199): error 0x3009 (EGL_BAD_MATCH)
Backbuffer cannot be preserved
Caught a RuntimeException from the binder stub implementation.
java.lang.NullPointerException
    at android.inputmethodservice.IInputMethodWrapper.setSessionEnabled(IInputMethodWrapper.java:280)
    at com.android.internal.view.IInputMethod$Stub.onTransact(IInputMethod.java:129)
    at android.os.Binder.execTransact(Binder.java:404)
    at dalvik.system.NativeStart.run(Native Method)
Got RemoteException sending setActive(false) notification to pid 3117 uid 10052
 
Upvote 0

azzam223

Active Member
Licensed User
Longtime User
Erel I have question

if I have multi class template and I want to load data can i use single db request manager for example from code module and the target the main activity so I will call it in all classe template maybe this is problem because I Call the dbrequest from database code module
 
Upvote 0

azzam223

Active Member
Licensed User
Longtime User
my code is in class but I put the CreateRequest sub in code module and use main activity as a target

B4X:
public Sub CreateRequest() As DBRequestManager
    Dim req As DBRequestManager
    req.Initialize(main, ServerData)
    Return req
End Sub
 
Upvote 0

azzam223

Active Member
Licensed User
Longtime User
OK nothing happens Erel I know You Too busy I will do now as Don say And try if my problem not fixed I will create new thread
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…