NagarjunaReddy
NagarjunaReddy

Reputation: 8645

Android Twitter tweet Default Dialog?

Hi Every one is it possible to display default twitter tweet dialog in our application like this !

enter image description here

is it possible in case possible how to implement this dialog?

NOTE: i'm login to twitter account in some where of application no need to log in again just i want click some button this dialog is display how to do this one?

Upvotes: 0

Views: 1114

Answers (1)

Damien R.
Damien R.

Reputation: 3373

Is this is what you are looking for ?

Intent tweetIntent = new Intent();
tweetIntent.setType("text/plain");
tweetIntent.putExtra(Intent.EXTRA_TEXT, "---Place default text here---");
final PackageManager packageManager = getActivity().getPackageManager();
List<ResolveInfo> list = packageManager.queryIntentActivities(tweetIntent, PackageManager.MATCH_DEFAULT_ONLY);

for (ResolveInfo resolveInfo : list) {
        String p = resolveInfo.activityInfo.packageName;
    if (p != null && p.startsWith("com.twitter.android")) {//if the native twitter app is found
        tweetIntent.setPackage(p);
        startActivity(tweetIntent);
    }
}

Upvotes: 3

Related Questions