在Android的WhatsApp的分享图像图像、Android、WhatsApp

由网友(親吻ωǒ資夲)分享简介:我要上什么应用共享图像和我们聊....等等.........我有图像对GridView控件....每个图像点击必须将开放共享型的选择..但是累了本作code ..... plz帮助我.....任何想法.....我下面code。 grid_view.setOnItemClickListener(新OnItemClic...

我要上什么应用共享图像和我们聊....等等.........我有图像对GridView控件....每个图像点击必须将开放共享型的选择..但是累了本作code ..... plz帮助我.....任何想法.....我下面code。

  grid_view.setOnItemClickListener(新OnItemClickListener(){    @覆盖    公共无效onItemClick(适配器视图<>母公司,查看paramView,INT位置,长的id){        字符串路径=将String.valueOf(位置);        意图sharingIntent =新意图(Intent.ACTION_SEND);        乌里screenshotUri = Uri.parse(路径);        sharingIntent.setType(图像/ *);        如果(sharingIntent!= NULL){            sharingIntent.putExtra(Intent.EXTRA_STREAM,screenshotUri);            sharingIntent.putExtra(Intent.EXTRA_STREAM,Uri.parse(android.resource:///绘制/+路径+.JPG));            sharingIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);            startActivity(Intent.createChooser(sharingIntent,分享图像使用));        }        其他{            Toast.makeText(getApplication(),Plase尝试agian,2000年).show();        }    }}); 

解决方案

下面是code共享意图。

  sendBroadcast(新意图(Intent.ACTION_MEDIA_MOUNTED,Uri.parse(文件://+ Environment.getExternalStorageDirectory())));意图sendIntent =新意图(Intent.ACTION_SEND);sendIntent.setType(图像/ PNG);sendIntent.putExtra(Intent.EXTRA_STREAM,Uri.fromFile(新文件(mScreenshotPath +/+ curentDateandTime +PNG)));startActivityForResult(sendIntent,0); 
iPhone恢复android上的app,如何恢复iPhone和Android上删除的WhatsApp消息

i want to share image on whats-app and we-chat....and so on......... i have image's on gridview....to each image click must will be open shareing option.. but m tired this make code.....plz help me.....and any idea..... and my code below.

grid_view.setOnItemClickListener(new OnItemClickListener() {
    @Override
    public void onItemClick(AdapterView<?> parent, View paramView, int position, long id) {
        String path=String.valueOf(position);
        Intent sharingIntent = new Intent(Intent.ACTION_SEND);

        Uri screenshotUri = Uri.parse(path);
        sharingIntent.setType("image/*");
        if (sharingIntent !=null) {
            sharingIntent.putExtra(Intent.EXTRA_STREAM, screenshotUri);
            sharingIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("android.resource:///drawable/" +path + ".jpg"));
            sharingIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(Intent.createChooser(sharingIntent, "Share image using"));    
        }
        else {
            Toast.makeText(getApplication(), "Plase try agian", 2000).show();
        }

    }
});    

解决方案

Here is the code for sharing intent.

sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://"+ Environment.getExternalStorageDirectory())));    

Intent sendIntent = new Intent(Intent.ACTION_SEND);     

sendIntent.setType("image/png");
sendIntent.putExtra(Intent.EXTRA_STREAM,Uri.fromFile(new File(mScreenshotPath+"/"+curentDateandTime+".png")));
startActivityForResult(sendIntent, 0);

阅读全文

相关推荐

最新文章