built-in Android sharing module, the Facebook Android application -


it possible share facebook using share intent. when click on send button, list of default application set on device shown in pop dialog. question is possible share 1 application using share intent. example using share intent send facebook only. share intent open native facebook application directly.

i found link: http://vnstep.wordpress.com/2012/04/14/share-via-android/

but

intent shareintent = new intent(android.content.intent.action_send);     shareintent.settype("text/plain");     shareintent.putextra(android.content.intent.extra_subject, "anc");     shareintent.putextra(android.content.intent.extra_text, "ccc");     packagemanager pm = context.getpackagemanager();     list<resolveinfo> activitylist = pm.queryintentactivities(shareintent, 0);     (final resolveinfo app : activitylist) {         if ((app.activityinfo.name).contains("facebook")) {             final activityinfo activity = app.activityinfo;             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);             context.startactivity(shareintent);             break;         }     } 

getting error log

07-19 21:26:30.320: e/androidruntime(4974): fatal exception: main 07-19 21:26:30.320: e/androidruntime(4974): java.lang.runtimeexception: unable start activity componentinfo{fb.app/fb.app.mainactivity}: java.lang.nullpointerexception 07-19 21:26:30.320: e/androidruntime(4974):     @ android.app.activitythread.performlaunchactivity(activitythread.java:2182) 07-19 21:26:30.320: e/androidruntime(4974):     @ android.app.activitythread.handlelaunchactivity(activitythread.java:2207) 07-19 21:26:30.320: e/androidruntime(4974):     @ android.app.activitythread.access$600(activitythread.java:139) 07-19 21:26:30.320: e/androidruntime(4974):     @ android.app.activitythread$h.handlemessage(activitythread.java:1205) 07-19 21:26:30.320: e/androidruntime(4974):     @ android.os.handler.dispatchmessage(handler.java:99) 07-19 21:26:30.320: e/androidruntime(4974):     @ android.os.looper.loop(looper.java:137) 07-19 21:26:30.320: e/androidruntime(4974):     @ android.app.activitythread.main(activitythread.java:4899) 07-19 21:26:30.320: e/androidruntime(4974):     @ java.lang.reflect.method.invokenative(native method) 07-19 21:26:30.320: e/androidruntime(4974):     @ java.lang.reflect.method.invoke(method.java:511) 07-19 21:26:30.320: e/androidruntime(4974):     @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:791) 07-19 21:26:30.320: e/androidruntime(4974):     @ com.android.internal.os.zygoteinit.main(zygoteinit.java:558) 07-19 21:26:30.320: e/androidruntime(4974):     @ dalvik.system.nativestart.main(native method) 07-19 21:26:30.320: e/androidruntime(4974): caused by: java.lang.nullpointerexception 07-19 21:26:30.320: e/androidruntime(4974):     @ fb.app.mainactivity.oncreate(mainactivity.java:54) 07-19 21:26:30.320: e/androidruntime(4974):     @ android.app.activity.performcreate(activity.java:5008) 07-19 21:26:30.320: e/androidruntime(4974):     @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1079) 07-19 21:26:30.320: e/androidruntime(4974):     @ android.app.activitythread.performlaunchactivity(activitythread.java:2136) 07-19 21:26:30.320: e/androidruntime(4974):     ... 11 more 

you can not filter application share intent. if still want use facebook sdk.


Comments