Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I have image steganography app for android. The main function of this app have worked well, such as encoding, decoding, and save images in phone storage.

But, I want a picture that has been inserted a secret message can be shared with other app like Whatsapp, Facebook, Twitter. After I try to make the share button and click the button, I was not given a choice application where I will share those images.

However, I was directed to the MMS message. although the MMS message can work well, but I want to be able to choose the app where I will share images.

Can you help me fix the code?
Thank you!!

What I have tried:

This is a part of encoding code where assosiated with share button :

Java
Button buttonShare = (Button) findViewById(R.id.share);
buttonShare.setOnClickListener(new Button.OnClickListener() {

    public void onClick(View v) {

        closeContextMenu();
        closeOptionsMenu();
        progressBar=new MobiProgressBar(EncodeActivity.this);
        progressBar.setMax(100);
        progressBar.setMessage(context.getString(R.string.encoding));
        progressBar.show();
        Thread tt = new Thread(new Runnable() {
            public void run() {
                Uri uri= encode();
                ShareIntent share=new ShareIntent(uri,EncodeActivity.this);
                progressBar.dismiss();
                share.send();
            }
        });
        tt.start();
    }
});


And this code for share method :

Java
import android.content.Context;
import android.content.Intent;
import android.net.Uri;

public class ShareIntent {
private Uri uri;    
private final Context context;

public Uri getUri() {
    return uri;
}

public void setUri(Uri uri) {
    this.uri = uri;
}   

public ShareIntent(Uri uri,Context context) {       
    this.uri = uri;
    this.context=context;
}

public void send()
{
    Intent shareIntent = new Intent(Intent.ACTION_SEND);
    shareIntent.putExtra(Intent.EXTRA_STREAM,uri);
    shareIntent.setType("image/jpeg");
    context.startActivity(Intent.createChooser(shareIntent, "Share Image"));
}
}
Posted
Updated 27-Nov-16 2:41am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900