lundi 11 mai 2015

Getting a clickable URL from strings.xml for a share Intent Android Studio

I've been searching for hours trying to get my share Intent to be a hyperlink to a specific URL. I saw a lot of answers for this for a TextView but none for a sharing intent and I couldn't figure out how to get the textView answers applied to this.

Basically I want this string

<string name="link"><a href="http://ift.tt/1zWqwQj">EatingOut</a></string>

to work with

    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_restaurant);
    share = getString(R.string.link);
}

    private void setShareIntent() {

    if (mShareActionProvider != null) {

        Intent shareIntent = new Intent(Intent.ACTION_SEND);
        shareIntent.setType("text/plain");
        shareIntent.putExtra(Intent.EXTRA_SUBJECT, "Share");
        shareIntent.putExtra(Intent.EXTRA_TEXT, "Eating at "+ title.getText() + " #" + share );

        mShareActionProvider.setShareIntent(shareIntent);
    }
}

The problem is when I share it, there is no hyperlink to the "share" part. I have tried many different suggestions I read here but like I said most were for textViews

Aucun commentaire:

Enregistrer un commentaire