If you've implemented a share button in your Android application toolbar, and when button is pressed and you go back without sharing the text, you might get the titled error. See the below Answer why that will always happen.
Intent intent = new Intent();
intent.setType("text/plain");
intent.setAction(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_SUBJECT, "title");
intent.putExtra(Intent.EXTRA_TEXT, "text");
startActivity(Intent.createChooser(intent, "Share"));
SOLUTION
Just know that the above code is correct, the only reason why the error is coming up is because the updated custom version of your android Operating system.
If you doubt me, send the App in a lower version OS of an android phone and try sharing again, you will notice that the error won't come up again.
The only thing you need to know is that the error won't kill your application, and it doesn't come up all the time. if the user do click on share button and proceed with the sharing, it won't show.
Intent intent = new Intent();
intent.setType("text/plain");
intent.setAction(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_SUBJECT, "title");
intent.putExtra(Intent.EXTRA_TEXT, "text");
startActivity(Intent.createChooser(intent, "Share"));
SOLUTION
Just know that the above code is correct, the only reason why the error is coming up is because the updated custom version of your android Operating system.
If you doubt me, send the App in a lower version OS of an android phone and try sharing again, you will notice that the error won't come up again.
The only thing you need to know is that the error won't kill your application, and it doesn't come up all the time. if the user do click on share button and proceed with the sharing, it won't show.
SHARE THIS POST
0 comments:
Post a Comment