-1

ギャラリーの下の画像を表示する作業をしています。コードは次のとおりです。ここで、編集テキストで名前が指定される特定のフォルダーで画像を開きたいと思います。現在、アプリケーションとは関係のないすべての画像を開いており、画像を特定するのが難しいため、それを行うのを手伝ってください。

protected void LoadGalleryImages() {
        final String[] columns = { MediaStore.Images.Media.DATA,
                MediaStore.Images.Media._ID };
        final String orderBy = MediaStore.Images.Media._ID;
        imagecursor = managedQuery(
                MediaStore.Images.Media.EXTERNAL_CONTENT_URI, columns, null,
                null, orderBy);
        int image_column_index = 0;

        if (imagecursor != null) {
            image_column_index = imagecursor
                    .getColumnIndex(MediaStore.Images.Media._ID);
            count = imagecursor.getCount();
        }

        imgSelected = new String[count];

        arrPath = new String[count];
        thumbnailsselection = new boolean[count];
        for (int i = 0; i < count; i++) {
            if (imagecursor != null) {
                imagecursor.moveToPosition(i);
                // int id = imagecursor.getInt(image_column_index);
                int dataColumnIndex = imagecursor
                        .getColumnIndex(MediaStore.Images.Media.DATA);

                arrPath[i] = imagecursor.getString(dataColumnIndex);
            }

        }
    }
4

1 に答える 1

0

プージャ、

指定したフォルダーを開いてファイルを参照するコードは次のとおりです。

Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
Uri uri = Uri.parse("folder path");

//Change content type as you want if you dont know then just mention "*/*"
intent.setDataAndType(uri, "text/csv");

startActivity(Intent.createChooser(intent, "Open folder"));

これがあなたを助けることを願っています。

于 2013-12-16T08:14:42.210 に答える