user668332
user668332

Reputation: 13

Android Open gallery to folder and slide through images

I'm able to open Gallery in a specific folder and image; however, when I try to slide through the images that functionality does not seem to work. Since I'm opening the Gallery app I figured that Gallery should handle this functionality. Anyone have any ideas? Can't seem to figure out what to do.

Below is my code

public OpenGalleyToSpecificFolder( Context _context, String path, String fileName){
        mContext = _context;
        mMediaScannerConnection = null;
        mPath = path;
        mFileName = fileName;
    }

    public void OpenGallary( ){
        File folder_name = new File(mPath);
        allFiles = folder_name.listFiles();
        for(int i = allFiles.length - 1; i > 0; --i){
            if(allFiles[i].getName().equals(mFileName)){
                index = i;
                break;
            }
        }

        if(mMediaScannerConnection == null)
            mMediaScannerConnection = new MediaScannerConnection(mContext, this);

        mMediaScannerConnection.connect();
    }

    @Override
    public void onMediaScannerConnected() {
        mMediaScannerConnection.scanFile(allFiles[index].getAbsolutePath(),   null);
    }

    @Override
    public void onScanCompleted(String path, Uri uri) {
        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setData(uri);
        mContext.startActivity(intent);
        mMediaScannerConnection.disconnect();
    }

Upvotes: 0

Views: 168

Answers (1)

CommonsWare
CommonsWare

Reputation: 1007533

There are thousands of Android device models. There will be hundreds of different "gallery apps" pre-installed across those models, let alone other apps that support ACTION_VIEW that users install themselves. What those apps do, in response to your Intent, is up to the developers of those apps, not you.

If you want a specific look-and-feel to browsing images, implement your own image-browsing UI in your app.

Upvotes: 1

Related Questions