I want to share a text in any messaging app as plain text. On clicking this text: the user will navigate to the application if present otherwise it will take it to play store. I am new in android, Please help me out of this. Thanks in advance
Asked
Active
Viewed 42 times
-1
-
https://stackoverflow.com/questions/17877595/i-want-text-view-as-a-clickable-link Check this. – Thusitha Malshan Aug 19 '18 at 19:21
-
@ThusithaMalshan I want to make link on text sends in whatsup,facebook and other social media – Vivek Pandey Aug 22 '18 at 15:20
2 Answers
0
You can share the text, but the power to handle that is not in your hands, since you don't have any authority over the third party application which handles the text.

Yauraw Gadav
- 1,706
- 1
- 18
- 39
-
Thanks!! but how other application like myntra, flipkart and amazon is doing – Vivek Pandey Aug 22 '18 at 15:21
0
You need to do like this on click of your text
final String appPackageName = "com..."; /*this is the package name you want to redirect application*/
try {
Toast.makeText(MainActivity.this, "Application is already insatlled", Toast.LENGTH_LONG).show();
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
finish();
} catch (android.content.ActivityNotFoundException anfe) {
Toast.makeText(SplashActivity.this, "Redirecting to your app on playstore", Toast.LENGTH_LONG).show();
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName)));
finish();
}

R7G
- 1,000
- 1
- 10
- 15