Hi all
i had try this project from this thread ( https://www.b4x.com/android/forum/threads/solve-error-open-pdf-file-with-android-7.97467/ ) to open pdf download from web service, but got error "(NullPointerException) java.lang.NullPointerException:Attempt to invoke virtual method android.content.res.XmlResourceParser android.content.pm.ProviderInfo.loadXmlMetaData(android.content.pm.PackageManager,jva.lang.String) on a null object reference"
Anybody can help me,where wrong to my code:
Thanks
i had try this project from this thread ( https://www.b4x.com/android/forum/threads/solve-error-open-pdf-file-with-android-7.97467/ ) to open pdf download from web service, but got error "(NullPointerException) java.lang.NullPointerException:Attempt to invoke virtual method android.content.res.XmlResourceParser android.content.pm.ProviderInfo.loadXmlMetaData(android.content.pm.PackageManager,jva.lang.String) on a null object reference"
Anybody can help me,where wrong to my code:
B4X:
Sub imgdownload_Click
Dim intresult As Int
intresult=Msgbox2("Download Report ??","Download","Yes","Cancell","",Null )
If intresult=DialogResponse.POSITIVE Then
ProgressDialogShow2("Please wait . . .", True)
Dim job As HttpJob
job.Initialize("pdf" , Me)
Dim S As String = Starter.serverAddress & "/report.php?usr=" & Starter.strusr & "&psw=" & Starter.strtoken
job.Download(s)
wait for (job) JobDone (job As HttpJob)
If job.Success = True Then
Try
Dim out As OutputStream=File.OpenOutput(Starter.shared ,"report.pdf", False )
File.Copy2(job.GetInputStream ,out)
out.Close
Dim Intent1 As Intent
Intent1.Initialize(Intent1.ACTION_VIEW, app.CreateFileProviderUri(Starter.shared, "report.pdf"))
Intent1.SetType("application/pdf")
Intent1.Flags = 1
Try
StartActivity(Intent1)
Catch
MsgboxAsync("No App to display PDF files is installed on your device...." & CRLF & CRLF & LastException,"Error PDF")
End Try
Catch
Log(LastException)
End Try
End If
job.Release
ProgressDialogHide
End If
End Sub
Thanks