Android Question Error Unknown

BudiWang

Member
Licensed User
Longtime User
I got error from my code, but the B4A doesnt show which line code to be error
the log show:

LogCat connected to: B4A-Bridge: GT-I9300 GT-I9300-351869058577423
--------- beginning of /dev/log/main
--------- beginning of /dev/log/system
** Service (ngoceh) Destroy **
Ignoring event as service was destroyed.
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:b4a.example
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Service (ngoceh) Create **
** Service (ngoceh) Start **
** Service (ngoceh) Start **
** Service (ngoceh) Start **
** Service (ngoceh) Start **
** Activity (main) Pause, UserClosed = false **
java.lang.NullPointerException <------------------ Error When change Activity Main To Activity Chat
** Activity (chat) Create, isFirst = true **
** Activity (chat) Resume **
** Service (ngoceh) Start **
** Service (ngoceh) Start **
** Activity (chat) Pause, UserClosed = true **
** Activity (main) Resume **
** Service (ngoceh) Start **
** Service (ngoceh) Start **
** Activity (main) Pause, UserClosed = false **
** Service (ngoceh) Start **
java.lang.NullPointerException <--------------------- Error
** Activity (chat) Create, isFirst = false **
** Activity (chat) Resume **
** Service (ngoceh) Start **
** Activity (chat) Pause, UserClosed = true **

Because of this error my "Ngoceh" Service got stuck on waiting response from HTTPclient object(stuck forever until i back to Main Activity, the service execute the HTTP response)

Detail of error:

** Activity (main) Pause, UserClosed = false **
setKeyboardVisibility: false
Launching: ActivityRecord{41bc39c0 b4a.example/.chat}
Changing focus from Window{41c9c190 b4a.example/b4a.example.main paused=true} to null
setInputWindows
Losing focus: Window{41c9c190 b4a.example/b4a.example.main paused=true}
setInputWindows
setInputWindows
java.lang.NullPointerException
setInputWindows
setInputWindows
Changing focus from null to Window{41c234d0 b4a.example/b4a.example.chat paused=false}
setLightsOn(true)
setInputWindows
setInputWindows
Gaining focus: Window{41c234d0 b4a.example/b4a.example.chat paused=false}
** Activity (chat) Create, isFirst = false **
false false
false false

Help me , i already stuck for 2 days
 

BudiWang

Member
Licensed User
Longtime User
i already use your httputils2 with modification (Ngoceh services is same as httputilservice )
i check the problem that http object doesnt give response forever until i change the activity
can i give my all source code to your email (Erel)?
so you can check that strange behavior error because i think something wrong with http object why not give response finish / error(from http response object)
 
Last edited:
Upvote 0

BudiWang

Member
Licensed User
Longtime User
I got the real error

set: Alarm{41c364a8 type 1 b4a.example}
Adding alarm Alarm{41c364a8 type 1 b4a.example} at 0
alarms: 4 type: 1
0: Jul 18 02:05:35 pm b4a.example
1: Jul 18 03:24:21 pm com.baidu.searchbox
2: Jul 19 12:00:00 am com.android.calendar
3: Jul 19 12:00:00 am android
Native set alarm :Alarm{41c364a8 type 1 b4a.example}
java.lang.IllegalStateException: Target host must not be null, or set in parameters. scheme=null, host=null, path=
at org.apache.http.impl.client.DefaultRequestDirector.determineRoute(DefaultRequestDirector.java:599)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:293)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
at anywheresoftware.b4a.http.HttpClientWrapper$3.run(HttpClientWrapper.java:199)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:442)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
Package has already posted 50 toasts. Not showing more. Package=b4a.example
set: Alarm{41aadc38 type 1 b4a.example}
Adding alarm Alarm{41aadc38 type 1 b4a.example} at 0


Not showed on B4A log error, i check every line so i got this
 
Upvote 0

BudiWang

Member
Licensed User
Longtime User
My service is send request every second with condition no have process on httpclient(status=false no process, status = true in process).
this program base on chat app so need to check real time.
globalcode was my code module so i can access the value and function/sub for every activity

the problem only occurs when i change activity from main to chat activity
the service still working every 1 sec to check update
but httpclient doesnt give response finish or error(still same waiting for 30sec)

java.lang.IllegalStateException: Target host must not be null, or set in parameters. scheme=null, host=null, path=
at org.apache.http.impl.client.DefaultRequestDirector.determineRoute(DefaultRequestDirector.java:599)

thats the problem, i dont understand why illegalstateexception occurs, and which target host is null, i check every variabel i m use is not null including object
(you can see log on first and third post)

if i push the button back (back to main activity), httpclient working again

can i send to your email my all source code to you Erel?
so you can check
 
Last edited:
Upvote 0

eps

Expert
Licensed User
Longtime User
I concur, I suspect that either you're not using a Global for the variable, or something like StateManager which restores values to their state, when the process restarts..
 
Upvote 0

BudiWang

Member
Licensed User
Longtime User
Statemanager? can u explain it
all variabel i m use for sharing data is global
this is strange problem, why only HttpClient not working and not give response and other process (log and toastmessage still can be show every sec) still can do in services

then problem is why this java.lang.NullPointerException occurs and only impact to HttpClient
i already change use HttpUtil2service but the problem still same, not working on HttpClient, its not give response for ever until i change activity
 
Upvote 0
Top