Android studio 我尝试从gallery上载图像后,我的应用程序崩溃
我尝试使用以下代码从图库上载图像:Android studio 我尝试从gallery上载图像后,我的应用程序崩溃,android-studio,uri,navigation-drawer,picasso,android-image,Android Studio,Uri,Navigation Drawer,Picasso,Android Image,我尝试使用以下代码从图库上载图像: public void oc_chooseImage(View view) { Intent intent = new Intent ( ); intent.setType ( "image/*" ); intent.setAction ( Intent.ACTION_GET_CONTENT ); startActivityForResult (intent,1); } @Override
public void oc_chooseImage(View view) {
Intent intent = new Intent ( );
intent.setType ( "image/*" );
intent.setAction ( Intent.ACTION_GET_CONTENT );
startActivityForResult (intent,1);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult ( requestCode, resultCode, data );
if(requestCode == 1 && resultCode==RESULT_OK && data != null && data.getData () != null)
{
imageUri = data.getData ();
mv_logo.setImageURI ( imageUri );
nav_logo.setImageURI ( imageUri );
}
}
有什么问题吗?我在android studio中的最低版本是19 api,我尝试用手机运行我的应用程序,而gallery会崩溃并停止我的应用程序。我的应用程序运行非常缓慢,或者在我尝试上载大图像时崩溃。请添加logcat错误,因为我的应用程序不会出错。