我正在捕捉Image并在其他设备上显示得非常好但是当我点击三星Galaxy S4时,它没有显示在ReyclerView中,而是它的持有占位符。我想展示我对Clicked Image的预览..我做了什么,它在下面。
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();
}
}
答案 0 :(得分:0)
我想你可以试试这个
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);
答案 1 :(得分:0)
经过一些修改,最后,我得到了我的输出。
我在这做了什么,
首先,我通过Overriding onSaveInstanceStatelike将我的数据存储到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: ");
}
现在,在捕获它之后,我从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);
}