通过Android意图在社交网站上分享照片

时间:2014-07-24 20:10:29

标签: android

我试图通过安装在Android手机中的社交网站分享照片,一般使用android intent。以下是我的代码。

package com.example.final_share;

import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MainActivity extends Activity {
Button b;
String path="https://...some url path"
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    b=(Button)findViewById(R.id.button1);
    b.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            Intent sharingIntent = new Intent(Intent.ACTION_SEND);
            Uri screenshotUri = Uri.parse(path);

            sharingIntent.setType("image/*");
            sharingIntent.putExtra(Intent.EXTRA_STREAM, screenshotUri);
            startActivity(Intent.createChooser(sharingIntent, "Share image using"));

        }
    });

}



}

但问题是我的状态只是上传而不是图片。有人可以帮我这个吗?如果我想从网络服务器获取图片并尝试分享这些数据我将如何做到这一点?

0 个答案:

没有答案
相关问题