How To Show Twitter Publishing Dialog Like Iphone

I integrate twitter in my application and want to show the twitter post dialog available on iphone, it looks like the image below.

enter image description here

Can we have this dialog in Android and how?

+6
source share
3 answers

I think it is a bad idea to try copying the user interface from the platform to another.

I recommend that you use the intention to share:

http://mobile.tutsplus.com/tutorials/android/android-sdk-implement-a-share-intent/

http://developer.android.com/training/sharing/send.html

It is very easy to use and integrated with the platform.

+6
source

you can do this by finding the Twitter application from the intent of sharing, if it is installed, but if you can’t handle this condition and open your Twitter application page, as in my lower code, since I found that twitter4j is difficult to integrate and give results inconsistencies.

Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND); shareIntent.setType("text/plain"); shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "subject"); shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, " text"; final PackageManager pm = v.getContext().getPackageManager(); final List<ResolveInfo> activityList = pm.queryIntentActivities(shareIntent, 0); boolean twtchk=false; for (final ResolveInfo app : activityList) { if ("com.twitter.android.PostActivity".equals(app.activityInfo.name)) { final ActivityInfo activity = app.activityInfo; System.out.println("package==="+activity.applicationInfo.packageName); final ComponentName name = new ComponentName(activity.applicationInfo.packageName, activity.name); shareIntent.addCategory(Intent.CATEGORY_LAUNCHER); shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); shareIntent.setComponent(name); v.getContext().startActivity(shareIntent); twtchk=true; break; } } if(!twtchk) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://twitter.com/yourapp")); startActivity(intent); } 
+2
source

Create this view in xml and use it. here is a tutorial for posting a string to twitter using twitter4j

+1
source

Source: https://habr.com/ru/post/923541/


All Articles