[英]Camera Issue in SamSung Galaxy S4
I am capturing Image and its showing pretty well in others device but When I clicked on Samsung Galaxy S4, its not showing in ReyclerView but its holding placeholder. 我正在捕获Image及其在其他设备中的显示效果很好,但是当我单击Samsung Galaxy S4时,它不在ReyclerView中显示,而是在其占位符中显示。 I want to show my preview for Clicked Image.. What I had done , it is below. 我想显示单击图像的预览。
if (requestCode == CAMERA_REQUEST) {
try {
if (requestCode == CAMERA_REQUEST && resultCode == RESULT_OK && null != data) {
String[] projection = {MediaStore.Images.Media.DATA};
Cursor cursor = managedQuery(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
projection, null, null, null);
int column_index_data = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToLast();
img_Decodable_Str = cursor.getString(column_index_data);
stream_imagePath.add(img_Decodable_Str);
CreateStreamAdapter createStreamAdapter = new CreateStreamAdapter(getApplicationContext(), stream_imagePath);
recycler_view.setAdapter(createStreamAdapter);
createStreamAdapter.notifyDataSetChanged();
dialog.dismiss();
}
} catch (Exception e) {
e.printStackTrace();
}
}
I think you can try this 我想你可以试试看
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
pic = new File(Environment.getExternalStorageDirectory(),
"image name") + ".jpg");
picUri = Uri.fromFile(pic);
cameraIntent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, picUri);
cameraIntent.putExtra("return-data", true);
startActivityForResult(cameraIntent, PHOTO);
After few modifications, Finally, I got my output. 经过几次修改,最后,我得到了输出。
What I did is here, 我在这里所做的
Firstly, I am storing my data into BUndle by Overriding onSaveInstanceStatelike below 首先,我通过覆盖如下的onSaveInstanceStateState将数据存储到BUndle中
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putStringArrayList("savedList", stream_imagePath);
System.out.println("On Saved Called ");
Log.d("SAVED ", "onSaveInstanceState: ");
}
And now, after capturing it, I am getting all those images from ArrayList 现在,在捕获它之后,我将从ArrayList中获取所有这些图像
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
View v = getLayoutInflater().inflate(R.layout.activity_create_stream, null);
setContentView(v);
activity = CreateStreamActivity.this;
init(v);
if (savedInstanceState != null) {
stream_imagePath = savedInstanceState.getStringArrayList("savedList");
createStreamAdapter = new CreateStreamAdapter(getApplicationContext(), stream_imagePath);
recycler_view.setAdapter(createStreamAdapter);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.