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 :
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 :
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"));
}
}