Android facebook SDK,使用不同语言的配置文件将图片上传到墙上?

标签 android facebook upload image

目前我可以使用我的应用程序将消息和图片发布到我的墙上,通过查找相册“Wall Photos”到目前为止它工作正常,我让我的一个 friend 在他的手机上测试我的应用程序以查看如果它适用于任何用户,当他尝试上传图片时它没有用,现在我认为这可能与他的个人资料是西类牙语有关,所以寻找相册“Wall photos”不可能,我看了看他的相册,令我惊讶的是他没有任何与他的语言相当的“墙照片”相册, 所以..长话短说:

a) 如果用户的个人资料使用不同的语言,我如何查找“Wall Photos”相册?

b) 如果“Wall Photos”相册不存在,我该如何创建它?

感谢任何帮助,谢谢。

最佳答案

将您的代码发布到如何将图片上传到 Facebook。这是一个对我来说工作正常的示例代码,看看可能对你有帮助。在我的代码中,我没有创建任何相册 Wall Photos。我的照片被上传到墙上。看看...

private void fbImageSubmit() {
    if (facebook != null) {
        if (facebook.isSessionValid()) {
            try {
                byte[] data = null;

                // Bitmap bi = BitmapFactory.decodeFile(Constants.imgShare);
                ByteArrayOutputStream baos = new ByteArrayOutputStream();

                bmScreen.compress(Bitmap.CompressFormat.JPEG, 100, baos);
                data = baos.toByteArray();

                Bundle parameters = new Bundle();
                parameters.putString("message", strmsg);
                parameters.putString("method", "photos.upload");
                parameters.putByteArray("picture", data);

                facebook.request(null, parameters, "POST");
                /*
                 * time = Calendar.getInstance().getTime().getHours() + ":"
                 * + Calendar.getInstance().getTime().getMinutes();
                 */

                currentTime = DateFormat.format("hh:mm", d.getTime());
                currentDate = DateFormat.format("dd/MM/yyyy", d.getTime());

                Cursor cursor = Constants.dbHelper
                        .GetDataFromImageName(Constants.enhancedImage
                                .getImagename());
                if (cursor.getCount() > 0) {
                    Constants.dbHelper.updateData(currentDate.toString(),
                            currentTime.toString(), "Facebook", "Image");
                } else {
                    Constants.dbHelper.insertData("true");
                }
                Toast.makeText(getApplicationContext(),
                        "Image uploaded successfully.", Toast.LENGTH_LONG)
                        .show();

            } catch (Exception e) {
                // TODO: handle exception
                System.out.println(e.getMessage());
            }
        }
    }
}

//bmscreen 是我的图像位图; 希望对您有所帮助。

关于Android facebook SDK,使用不同语言的配置文件将图片上传到墙上?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10629613/

相关文章:

android - 错误运行 Tensorflow 示例 Android

java - 如何在首选项 Activity 中创建首选项更改的监听器?

java - 我如何使用 restfb 在 Facebook 上分享帖子

javascript - 在使用 HTML5 文件 API 上传之前唯一标识文件

python - Django 文件上传和模型 FileField

android - 多个 apk 的多个包名称

android - 如何通过 TCP 使用 ADB 连接到 Android?

python - 如何在 ubuntu 上安装 facebook watchman?

facebook - 我们如何要求用户接受我们 Facebook SSO 中的所有权限?

php - 将文件加字符串从 android 上传到服务器不起作用