我的目標是從的ImageView共享圖像內RecyclerView到apps.The圖像從使用畢加索LIB 火力地堡存儲加載的其他。如何分享RecyclerView中的圖像?
我在每個項目下添加了一個「共享」按鈕,但無法繼續進一步操作。
這是我的MainActivity。
public class MainActivity extends AppCompatActivity {
private RecyclerView mBlogList;
private DatabaseReference mDatabase;
private LinearLayoutManager mLayoutManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mDatabase = FirebaseDatabase.getInstance().getReference().child("Blog");
mDatabase.keepSynced(true);
mBlogList = (RecyclerView) findViewById(R.id.blog_List);
mBlogList.setHasFixedSize(true);
mBlogList.setLayoutManager(new LinearLayoutManager(this));
mLayoutManager = new LinearLayoutManager(MainActivity.this);
mLayoutManager.setReverseLayout(true); // THIS ALSO SETS setStackFromBottom to true
mBlogList.setLayoutManager(mLayoutManager);
mLayoutManager.setStackFromEnd(true);
}
@Override
protected void onStart() {
super.onStart();
FirebaseRecyclerAdapter<Blog, BlogViewHolder> firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<Blog, BlogViewHolder>(
Blog.class,
R.layout.blog_row,
BlogViewHolder.class,
mDatabase
) {
@Override
protected void populateViewHolder(BlogViewHolder viewHolder, Blog model,int position) {
viewHolder.setTitle(model.getTitle());
viewHolder.setImage(getApplicationContext(), model.getImage());
}
};
mBlogList.setAdapter(firebaseRecyclerAdapter);
}
public static class BlogViewHolder extends RecyclerView.ViewHolder {
View mView;
public BlogViewHolder(View itemView) {
super(itemView);
mView = itemView;
}
public void setTitle(String title) {
TextView post_title = (TextView) mView.findViewById(R.id.post_title);
post_title.setText(title);
}
public void setImage(final Context ctx, final String image) {
final ImageView post_image = (ImageView) mView.findViewById(R.id.post_image);
Picasso.with(ctx).load(image).networkPolicy(NetworkPolicy.OFFLINE).into(post_image, new Callback() {
@Override
public void onSuccess() {
}
@Override
public void onError() {
//Try again online if cache failed
Picasso.with(ctx)
.load(image)
.error(R.drawable.header)
.into(post_image, new Callback() {
@Override
public void onSuccess() {
}
@Override
public void onError() {
Log.v("Picasso", "Could not fetch image");
}
});
}
});
}
}
你想分享圖像到其他應用程序的位置? –
我很抱歉沒有具體。是我想分享圖像到其他應用程序,以便用戶可以在fb或whatsapp上共享圖像。 –
FB不允許用戶共享其他應用程序的圖像,你可以共享圖像的鏈接,它會爲FB和Whats應用程序做你的工作 –