嘿,我想将我在 imageview 中的图像分享到 instagram,并且在我想分享图像之前使用 ACTION_SEND 我从其他活动中获取我的图片
我运行应用程序并收到消息“无法下载文件”
这是我的代码....如果有任何错误,请检查我的代码
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import java.io.File;
public class editPhoto extends Activity {
String picturePath;
@Override
protected void onCreate(Bundle savedInstanceState) {
overridePendingTransition(R.anim.push_left_in, R.anim.hold);
super.onCreate(savedInstanceState);
setContentView(R.layout.page);
picturePath = getIntent().getStringExtra("selectedPhoto");
Bitmap bitmap = BitmapFactory.decodeFile(picturePath);
ImageView imageView = (ImageView) findViewById(R.id.iv_pic);
imageView.setImageBitmap(bitmap);
TextView tv = (TextView) findViewById(R.id.imagepath);
tv.setText(picturePath);
Button share = (Button) findViewById(R.id.btnShare);
share.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("image/*");
intent.putExtra(Intent.EXTRA_STREAM, Uri.parse(picturePath));
startActivity(Intent.createChooser(intent, "Share"));
}
});
}
}