android - Can I share images on Twitter without Twitter app -
i'm trying share image on twitter app. i'm using tweetcomposer
in code share image on twitter share text not image. not given error or exception. so, want confirm possible share image on twitter without app?
yes can share images or links on twitter without application use code.first add socialauth 4.4.jar file in library , then
private socialauthadapter socialauthadapter; if (utils.isonline(activity)) { // initialize socialauthadapter responselistener pd = progressdialog.show(activity, null, null); socialauthadapter = new socialauthadapter(new responselistener( share)); // add twitter set provider post on twitter socialauthadapter.addprovider(socialauthadapter.provider.twitter, r.drawable.twitter); // line authorize start socialauthadapter.authorize(activity, socialauthadapter.provider.twitter); } else { // showing message when internet connection not available toast.maketext(activity, "check internet connection..", toast.length_long) .show(); }
and implement responce listener
private class responselistener implements dialoglistener { string message; public responselistener(string message) { this.message = message; } @override public void oncomplete(final bundle values) { // method call when successfull authorization done try { socialauthadapter.updatestatus(message, new uploadimagelistener(),true); new share_post().execute(); } catch (exception e) { e.printstacktrace(); } } @override public void onerror(socialautherror error) { // method call when error occured in authorization if (pd != null && pd.isshowing()) pd.dismiss(); log.d("sharetwitter", "authentication error: " + error.getmessage()); } @override public void oncancel() { // method call when user cancel authentication if (pd != null && pd.isshowing()) pd.dismiss(); log.d("sharetwitter", "authentication cancelled"); } @override public void onback() { // method call when user backpressed dialog if (pd != null && pd.isshowing()) pd.dismiss(); log.d("sharetwitter", "dialog closed pressing key"); } } private final class uploadimagelistener implements socialauthlistener<integer> { @override public void onerror(socialautherror e) { } @override public void onexecute(string arg0, integer arg1) { integer status = arg1; try { if (status.intvalue() == 200 || status.intvalue() == 201 || status.intvalue() == 204) { if (pd != null && pd.isshowing()) pd.dismiss(); toast.maketext(activity, "image uploaded", toast.length_short).show(); } else { if (pd != null && pd.isshowing()) pd.dismiss(); toast.maketext(activity, "image not uploaded", toast.length_short).show(); } } catch (nullpointerexception e) { if (pd != null && pd.isshowing()) pd.dismiss(); toast.maketext(activity, "image not uploaded", toast.length_short).show(); } } }
Comments
Post a Comment