peacemaker Expert Licensed User Longtime User Nov 30, 2017 #1 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 ?
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 Nov 30, 2017 #2 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
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.