When I call Android ACTION_VIEW, can I call the gallery by sending it to file:// or content://?

Asked 2 years ago, Updated 2 years ago, 97 views

When you click on a cluster marker, you want to implement the ability to open a picture in the Android System Gallery using the path of the file that the marker you clicked on.

Like the annotated part, the directory path is delivered normally and the gallery on the Android system is called normally, but the function I want to implement is that the gallery is not called

Image view that appears when you click a picture in the gallery list by passing the path value of the picture instead of the directory path...? I want it to run directly on the screen.

I feel like I can modify the uri delivery value well, but I don't know if it's an implementable method or if I'm making a fool of myself.

mClusterManager.setOnClusterItemClickListener(new ClusterManager.OnClusterItemClickListener<MyItem>() {
    @Override
    public boolean onClusterItemClick(MyItem myItem) {
        CameraUpdate center = CameraUpdateFactory.newLatLng(myItem.getPosition());
        map.animateCamera(center);
        //Toast.makeText(MainActivity.this, myItem.getPosition().toString(), Toast.LENGTH_SHORT).show();
        Log.e ("TAG", "Cluster-Item Click");

        //Uri targetUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
        //String targetDir = Environment.getExternalStorageDirectory().toString() + "/DCIM/Camera";
        //targetUri = targetUri.buildUpon().appendQueryParameter("bucketId", String.valueOf(targetDir.toLowerCase().hashCode())).build();


       // // Intent intent = new Intent(Intent.ACTION_VIEW, targetUri);
        String path = myItem.path;
        Log.e("TAG", "setOnClusterItemClickListener:: " + path.substring(1));
        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.fromFile(new File(myItem.path.substring(2))));

        startActivity(intent);

        return true;
    }
});

android intent

2022-09-22 19:52

1 Answers

Please refer to the link below.

https://code.i-harness.com/ko-kr/q/522675


2022-09-22 19:52

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.