Q:

Android Facebook share: activity not found

I have problem with my function for posting data on Facebook:
    public void postData() {
    try {
        Intent i = new Intent(Intent.ACTION_SEND);
        i.setClassName("com.facebook.katana",
                "com.facebook.katana.ShareLinkActivity");
        i.setType("text/*");
        i.putExtra(android.content.Intent.EXTRA_TEXT, "http://sample_url.com");
        startActivity(i);
    } catch (Exception e) {
        Intent i= new Intent(Intent.ACTION_VIEW);
        i.setData(Uri.parse("http://sample_url.com));
        startActivity(i);
    }
}

Every time I get information that activity com.facebook.katana.ShareLinkActivity can't be run and I should add code to the Android manifest. Facebook application is installed on the phone.
In AndroidManifest.xml:
    <activity android:name="com.facebook.katana.ShareLinkActivity" >
    </activity>

Exception in LogCat:
01-30 14:46:00.903: E/AndroidRuntime(11626): FATAL EXCEPTION: main
01-30 14:46:00.903: E/AndroidRuntime(11626): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.facebook.katana/com.facebook.katana.ShareLinkActivity}; have you declared this activity in your AndroidManifest.xml?
01-30 14:46:00.903: E/AndroidRuntime(11626):    at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1634)
01-30 14:46:00.903: E/AndroidRuntime(11626):    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1510)
01-30 14:46:00.903: E/AndroidRuntime(11626):    at android.app.Activity.startActivityFromChild(Activity.java:3531)
01-30 14:46:00.903: E/AndroidRuntime(11626):    at android.app.Activity.startActivityForResult(Activity.java:3283)
01-30 14:46:00.903: E/AndroidRuntime(11626):    at android.app.Activity.startActivity(Activity.java:3370)

A:

Finally I got this code to work:
        Intent sharingIntent = new Intent(Intent.ACTION_SEND);
        sharingIntent.setType("text/plain");
        sharingIntent.putExtra(Intent.EXTRA_SUBJECT, "Subject");
        sharingIntent.putExtra(Intent.EXTRA_TEXT, "Text...");
        sharingIntent.setPackage("com.facebook.katana");
        startActivity(sharingIntent);

Main points are setPackage and setType - now Android chooses right activity from Facebook package.

