java - Error with calling FileProvider from DialogFragment - null object of reference, -




i trying fix error kind of not seeing comes from.

from fragment creates new user calling fragmentdialog (on imagebutton click) enables me pick photo camera or gallery. gallery works fine, camera not. in line:

 uri photouri = fileprovider.geturiforfile(globalcontext, getactivity().getpackagename() + ".provider", getcamerafile()); 

i getting error:

java.lang.nullpointerexception: attempt invoke virtual method 'android.content.res.xmlresourceparser android.content.pm.providerinfo.loadxmlmetadata(android.content.pm.packagemanager, java.lang.string)' on null object reference 

all data displaying correctly (i check in logs).

where cna issue?

regards, grzegorz

edit:

full stack trace:

fatal exception: main                                                                              process: com.myapp.myapp, pid: 27523                                                                              java.lang.nullpointerexception: attempt invoke virtual method 'android.content.res.xmlresourceparser android.content.pm.providerinfo.loadxmlmetadata(android.content.pm.packagemanager, java.lang.string)' on null object reference                                                                                  @ android.support.v4.content.fileprovider.parsepathstrategy(fileprovider.java:583)                                                                                  @ android.support.v4.content.fileprovider.getpathstrategy(fileprovider.java:557)                                                                                  @ android.support.v4.content.fileprovider.geturiforfile(fileprovider.java:399)                                                                                  @ com.myapp.myapp.utils.picturedialog.ontakephoto(picturedialog.java:80)                                                                                  @ com.myapp.myapp.utils.picturedialog_viewbinding$1.doclick(picturedialog_viewbinding.java:32)                                                                                  @ butterknife.internal.debouncingonclicklistener.onclick(debouncingonclicklistener.java:22)                                                                                  @ android.view.view.performclick(view.java:5184)                                                                                  @ android.view.view$performclick.run(view.java:20893)                                                                                  @ android.os.handler.handlecallback(handler.java:739)                                                                                  @ android.os.handler.dispatchmessage(handler.java:95)                                                                                  @ android.os.looper.loop(looper.java:145)                                                                                  @ android.app.activitythread.main(activitythread.java:5940)                                                                                  @ java.lang.reflect.method.invoke(native method)                                                                                  @ java.lang.reflect.method.invoke(method.java:372)                                                                                  @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1389)                                                                                  @ com.android.internal.os.zygoteinit.main(zygoteinit.java:1184) 

fileprovider cannot find <provider> element in manifest has android:authorities value equal getactivity().getpackagename() + ".provider". specifically, code results in null value info:

final providerinfo info = context.getpackagemanager()             .resolvecontentprovider(authority, packagemanager.get_meta_data); 

(where context first parameter geturiforfile() , authority second parameter geturiforfile())

make sure supplied authority string matches <provider> element.





wiki

Comments

Popular posts from this blog

python - Read npy file directly from S3 StreamingBody -

python - Minimize function with Scipy minimize -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -