Skip to content

Instantly share code, notes, and snippets.

@takuo
Created February 28, 2012 10:59
Show Gist options
  • Save takuo/1931894 to your computer and use it in GitHub Desktop.
Save takuo/1931894 to your computer and use it in GitHub Desktop.
twicca plugin - share a status url
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" android:theme="@android:style/Theme.Translucent">
<activity
android:label="@string/activity_name"
android:name=".TweetLinkShare">
<intent-filter>
<action android:name="jp.r246.twicca.ACTION_SHOW_TWEET" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
Intent intent = getIntent();
String status_id = intent.getStringExtra("id");
String screen_name = intent.getStringExtra("user_screen_name");
String url = "https://twitter.com/#!/" + screen_name + "/status/" + status_id;
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.addCategory(Intent.CATEGORY_DEFAULT);
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_TEXT, url);
startActivity(shareIntent);
finish();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment