2
현재 "공유"버튼을 클릭하여 이미지를 공유 할 때 Android 응용 프로그램 자체에서 호출 의도를 만들려고합니다. 내가받은 오류NullPointerException with Android Nougat
Uri uImageFile = FileProvider.getUriForFile(DetailActivity.this, DetailActivity.this.getApplicationContext().getPackageName(), imageFile);
이되었다 :
java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.XmlResourceParser android.content.pm.ProviderInfo.loadXmlMetaData(android.content.pm.PackageManager, java.lang.String)' on a null object reference
at android.support.v4.content.FileProvider.parsePathStrategy(FileProvider.java:584)
at android.support.v4.content.FileProvider.getPathStrategy(FileProvider.java:558)
at android.support.v4.content.FileProvider.getUriForFile(FileProvider.java:400)
여기에 전체 코드가 있어요 그러나, 안드로이드 누가 얼마나 공유 텐트 함수의 변화,이 라인에 NullPointerException이 무엇입니까 내 공유 의도 방법 :
private void shareIntent() {
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setType("image/jpg");
File imageFile = new File(data.get(pos).getUrl());
Uri uImageFile = FileProvider.getUriForFile(DetailActivity.this, DetailActivity.this.getApplicationContext().getPackageName(), imageFile);
sharingIntent.putExtra(Intent.EXTRA_STREAM, uImageFile);
startActivity(Intent.createChooser(sharingIntent, getResources().getText(R.string.share_to)));
}
data.get(pos).getUrl()
내가 그 Parcelable
를 구현 만든 사용자 정의 클래스의 URL을 반환하고 때 ou는 인쇄 t를 입력하면 다음과 같은 디렉토리가 반환됩니다. "/storage/emulated/0/Pictures/primitive/Primitive-79538313.jpg"
제공 할 수있는 도움에 감사드립니다!
앱은 외부 저장 장치를 액세스 할 수있는 권한이 있습니까? – Xenolion
예, 나는 프로그램에 다음 권한을 모두 부여했습니다. –
Rahooligan