我想在下一个活动中显示捕获/图库图像,图像应该显示为https://play.google.com/store/apps/details?id=com.dietcoacher.sos&hl=en,我已经提到我的代码,我已经尝试过它工作正常,捕获图像不起作用。请发布。帮助我...
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
if (requestCode == REQUEST_CAMERA) {
Uri selectedImage = data.getData();
String[] filePathColumn = {MediaStore.Images.Media.DATA};
Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
//file path of captured image
imagepath = cursor.getString(columnIndex);
//file path of captured image
File f = new File(imagepath);
String filename = f.getName();
Toast.makeText(Contact.this, "Your Path:"+imagepath, 2000).show();
Toast.makeText(Contact.this, "Your Filename:"+filename, 2000).show();
cursor.close();
Log.i("image path", imagepath);
Bitmap bit = BitmapFactory.decodeFile(imagepath);
}
else if (requestCode == SELECT_FILE) {
//Bitmap photo = (Bitmap) data.getData().getPath();
Uri selectedImageUri = data.getData();
imagepath = getPath(selectedImageUri, null);
Bitmap bitmap=BitmapFactory.decodeFile(imagepath);
// bitmap = (Bitmap) data.getExtras().get("data");
Intent i = new Intent (Contact.this, NewContact.class);
i.putExtra("data",bitmap);
startActivity(i);
// messageText.setText("Uploading file path:" +imagepath);
}
}
}
logcat的
02-19 16:39:10.041:E / ActivityThread(32225):活动com.sec.android.gallery3d.app.Gallery泄露了IntentReceiver com.sec.samsung.gallery.view.albumview.AlbumViewState$21@42cc6710最初在这里注册。你是否错过了对unregisterReceiver()的调用? 02-19 16:39:10.041:E / ActivityThread(32225):android.app.IntentReceiverLeaked:Activity com.sec.android.gallery3d.app.Gallery泄露了IntentReceiver com.sec.samsung.gallery.view.albumview.AlbumViewState $ 42 @ 42cc6710最初在这里注册。你是否错过了对unregisterReceiver()的调用? 02-19 16:39:10.041:E / ActivityThread(32225):在android.app.LoadedApk $ ReceiverDispatcher。(LoadedApk.java:805) 02-19 16:39:10.041:E / ActivityThread(32225):在android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:606) 02-19 16:39:10.041:E / ActivityThread(32225):在android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1735) 02-19 16:39:10.041:E / ActivityThread(32225):在android.app.ContextImpl.registerReceiver(ContextImpl.java:1715) 02-19 16:39:10.041:E / ActivityThread(32225):在android.app.ContextImpl.registerReceiver(ContextImpl.java:1709) 02-19 16:39:10.041:E / ActivityThread(32225):在android.content.ContextWrapper.registerReceiver(ContextWrapper.java:453) 02-19 16:39:10.041:E / ActivityThread(32225):at com.sec.samsung.gallery.view.albumview.AlbumViewState.registerNetworkStateReceiver(AlbumViewState.java:1404) 02-19 16:39:10.041:E / ActivityThread(32225):at com.sec.samsung.gallery.view.albumview.AlbumViewState.onCreate(AlbumViewState.java:477) 02-19 16:39:10.041:E / ActivityThread(32225):at com.sec.samsung.gallery.model.ViewStateProxy.startState(ViewStateProxy.java:73) 02-19 16:39:10.041:E / ActivityThread(32225):at com.sec.samsung.gallery.controller.StartStateCmd.execute(StartStateCmd.java:27) 02-19 16:39:10.041:E / ActivityThread(32225):at org.puremvc.java.core.Controller.executeCommand(Controller.java:138) 02-19 16:39:10.041:E / ActivityThread(32225):at org.puremvc.java.core.Controller $ 1.onNotification(Controller.java:174) 02-19 16:39:10.041:E / ActivityThread(32225):at org.puremvc.java.patterns.observer.Observer.notifyObserver(Observer.java:87) 02-19 16:39:10.041:E / ActivityThread(32225):at org.puremvc.java.core.View.notifyObservers(View.java:134) 02-19 16:39:10.041:E / ActivityThread(32225):at org.puremvc.java.patterns.facade.Facade.notifyObservers(Facade.java:376) 02-19 16:39:10.041:E / ActivityThread(32225):at org.puremvc.java.patterns.facade.Facade.sendNotification(Facade.java:336) 02-19 16:39:10.041:E / ActivityThread(32225):at org.puremvc.java.patterns.facade.Facade.sendNotification(Facade.java:350)