我正在尝试将我的OpenGraph动作添加到新闻源,我了解到这一点,我需要将ExplicitlyShared功能添加到Facebook应用程序的OpenGraph操作设置中,我做到了.然而,当我把它放在我的代码中时,像这样:
OpenGraphObject model = OpenGraphObject.Factory.createForPost("origame_app:model");
model.setProperty("title", modelname);
model.setProperty("url", "http://samples.ogp.me/1386546688246429");
model.setProperty("description", modeldesc);
Bitmap bitmap = decodeSampledBitmapFromUri(filepath[position], 500, 500);
List<Bitmap> images = new ArrayList<Bitmap>();
images.add(bitmap);
OpenGraphAction action = GraphObject.Factory.create(OpenGraphAction.class);
action.setProperty("model", model);
action.setExplicitlyShared(true);
@SuppressWarnings("deprecation")
FacebookDialog shareDialog = new FacebookDialog.OpenGraphActionDialogBuilder(this, action, "origame_app:fold", "model")
.setImageAttachmentsForObject("model", images, true)
.build();
uiHelper.trackPendingDialogCall(shareDialog.present());
Run Code Online (Sandbox Code Playgroud)
我收到一个错误.但是否则OpenGraph工作得很好.有什么问题?
我试图制作一个只有图像而没有分隔符的列表视图,所以它看起来像一张大图.
这是适配器的代码:
public class ImageListAdapter extends ArrayAdapter<String> {
private final Context context;
private final int[] ImageValue;
private ImageView image;
public ImageListAdapter(Context context, int[] imageValue) {
super(context, R.layout.image_list_item);
this.context = context;
this.ImageValue = imageValue;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView;
rowView = inflater.inflate(R.layout.image_list_item, parent, false);
image = (ImageView) rowView.findViewById(R.id.image);
image.setImageDrawable(context.getResources().getDrawable(ImageValue[position]));
return rowView;
}
Run Code Online (Sandbox Code Playgroud)
}
这是image_list_item XML:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content" >
Run Code Online (Sandbox Code Playgroud)
这是主要活动:
public …Run Code Online (Sandbox Code Playgroud)