如何让用户使用SD卡的文件夹后的图像上墙文件夹、图像、用户、SD

由网友(一個人哭)分享简介:我允许用户的发布的消息对他们的[朋友及放大器;用户]长城的沿的单静态图片的,因为这个形象我使用的网络图片的URL 的I am allowing user to post a message on their [Friend & User] Wall along with single static image, an...

我允许用户的发布的消息对他们的[朋友及放大器;用户]长城的沿的单静态图片的,因为这个形象我使用的网络图片的URL 的

I am allowing user to post a message on their [Friend & User] Wall along with single static image, and for that image i am using Web Image URL

但现在我想的允许用户选择多个图像的任何单个图像的,就像存储在特定的文件夹中的 SD卡,然后发表10张沃尔的。

But now i wish to allow user to choose any single image from multiple images, like 10 images stored in a particular folder in SDCard, and then post to Wall.

因此,这里是我的问题,怎么办?的

我现有的code到华尔街 发表静态图片,阅读下面的:

My existing code to post static image on Wall, read below:

@Override
public void onClick(DialogInterface dialog, int which) {

        Bundle params = new Bundle();
            params.putString("to", String.valueOf(friendId));
        params.putString("caption", getString(R.string.app_name));
        params.putString("description", getString(R.string.app_desc));
        params.putString("link", "http://www.google.com");
            params.putString("picture",FacebookUtility.HACK_ICON_URL);
            params.putString("name",getString(R.string.app_action));

            FacebookUtility.facebook.dialog(FriendsList.this,
           "feed", params, (DialogListener) new PostDialogListener());
      }
  }).setNegativeButton(R.string.no, null).show();
 } catch (JSONException e) {
      showToast("Error: " + e.getMessage());
}

FacebookUtility.java: -

public static final String HACK_ICON_URL = "https://p.xsw88.cn/allimgs/daicuo/20230907/6741.png.jpg";

检查我的应用程序的现有屏幕,的

正如你可以看到上面的画面,我只显示一个静态图像正如我上面写的,但是现在我想允许用户使用SD卡来选择多个图像的图像,我的SD卡路径的这样的: / SD卡/ FbImages /

现在我想知道如何放置在上面的屏幕按钮[因为我没有使用任何自定义XML对于这一点,这是本土特色的FacebookSDK] 的

now i want to know how to place button in above screen [because i am not using any custom xml for this, that's native feature in FacebookSDK]

因此​​,这里是我的问题的如何打开SD卡文件夹,以及如何选择单张图像后,从多张图片的

So here is my question how to open sdcard folder and how to choose single image to post from multiple images

推荐答案

你必须找到路径的形象。

you have to find path for that image.

试试下面的code选择图像

try following code to select image

btnSelect.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
             Intent intent = new Intent();
             intent.setType("image/*");
             intent.setAction(Intent.ACTION_GET_CONTENT);
             startActivityForResult(Intent.createChooser(intent,"Select Picture"), 0);
        }
    });

获取路径selectd图片

get path for selectd image

public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == RESULT_OK) {
        if (requestCode == 0) {
            Uri selectedImageUri = data.getData();
            selectedImagePath = getPath(selectedImageUri);
            System.out.println("Image Path : " + selectedImagePath);

        }
    }
}

public String getPath(Uri uri) {
    String[] projection = { MediaStore.Images.Media.DATA };
    Cursor cursor = managedQuery(uri, projection, null, null, null);
    int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
    cursor.moveToFirst();
    return cursor.getString(column_index);
}

然后用

  params.putString("picture",selectedImagePath);
阅读全文

相关推荐

最新文章