Android Question HttpJob result: Bitmap or not ?

peacemaker

Expert
Licensed User
Longtime User
HI, All

If some URL is variable to be downloaded - it can be image or binary file, or text file (say, HTML formatted).
How to for sure determine the file kind, without job.GetBitmap inside Try\Catch block ?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
BTW, it is a mistake to use Job.GetBitmap. You should use Job.GetBitmapResize instead.

You can use OkHttpUtils2 source code instead of the library and add these lines to hc_ResponseSuccess:
B4X:
Dim job As HttpJob = TaskIdToJob.Get(TaskId)
   job.Tag = Response.ContentType

The content type will be stored in the job tag field. You can later extract it and see what the server claimed to return.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…