using http get for small queries

melamoud

Active Member
Licensed User
Longtime User
hi,

is there a lib or a way to submit an HTTP get request and get the result immidiatly in the calling sub (not through event) of course this should be used only for very small queries, like a status check for a specific site,

I have to write the code to hide this - is it even possible in B4A to hide the even usage of the current libraries ? (maybe using threading but thats just ugly )

:sign0163:
 

melamoud

Active Member
Licensed User
Longtime User
Network tasks should always be done in the background. Sending an empty request to a website can easily take a few seconds.

I agree thats why I have a service doing this not the UI thread
but still my task is to get an id and only if the ID pass a certian creteria get the whole page, chain it using events is messy especially when you need to reporty a status to the UI / notification when you are done

so you are saying there is no way to do this like that ?
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
If you want to comply with the official Android programming guidelines then you should not perform any network activity in the main UI thread.
Any network activity should be done in it's own thread asynchronously.

Take a look at the NetworkOnMainThreadException.
With versions of the Android API since Honeycomb your application will raise such an exception if you try to perform network activity on the main thread.

Martin.
 
Upvote 0
Top