android - Twitpic Error - Invalid Username and Password -
i using twitpic library post image on twitter m getting - invalid twitpic username , password error. there solution this?? username , password of witpic. using twitter id , password in place of it.
here's code
// create file file picture = new file(environment.getexternalstoragedirectory()+"/image.jpg"); if(picture.exists()) { system.out.println("picture accesseds"); } // create twitpic object , allocate twitpicresponse object twitpic tprequest = new twitpic("gauravarora90", "gaurav"); twitpicresponse tpresponse = null; // make request , handle exceptions try { tpresponse = tprequest.uploadandpost(picture, "hello world!!!"); } catch (ioexception e) { e.printstacktrace(); } catch (twitpicexception e) { e.printstacktrace(); } // if got response back, print out response variables if(tpresponse != null) { tpresponse.dumpvars(); system.out.println(tpresponse.getstatus()); if(tpresponse.getstatus().equals("ok")){ toast.maketext(getapplicationcontext(), "photo posted on twitter.",toast.length_short).show(); //picture.delete(); } } kindly me.thanks in advance.
try code :
configurationbuilder cb = new configurationbuilder(); cb.setoauthconsumerkey(twitterclass.consumer_key); cb.setoauthconsumersecret(twitterclass.consumer_secret); cb.setoauthaccesstoken(tw.getaccesstoken()); accesstoken = new accesstoken(tw.getaccesstoken(),tw.getsecrettoken()); twitterfactory tf = new twitterfactory(cb.build()); t4jtwitter = tf.getinstance(); t4jtwitter.setoauthaccesstoken(a); configuration conf = new configurationbuilder() .setoauthconsumerkey(twitterclass.consumer_key) .setoauthconsumersecret(twitterclass.consumer_secret) .setoauthaccesstoken(tw.getaccesstoken()) .setoauthaccesstokensecret(tw.getsecrettoken()) .build(); oauthauthorization auth = new oauthauthorization (conf, conf.getoauthconsumerkey (), conf.getoauthconsumersecret (), new accesstoken (conf.getoauthaccesstoken (), conf.getoauthaccesstokensecret ())); imageupload upload = imageupload.gettwitpicuploader (twitpic_key, auth); try { // string url = upload.upload(new file("/mnt/sdcard/download/3029302084159350163.jpg")); //result = 1; url myfileurl=new url(strfilepath); httpurlconnection conn = (httpurlconnection) myfileurl .openconnection(); conn.setdoinput(true); conn.connect(); inputstream = conn.getinputstream(); // string url = upload.upload(new file("/mnt/sdcard/download/3029302084159350163.jpg"), staticdata.strtwitte); string url = upload.upload(staticdata.strtwitte, is); system.out.println("image url"+url); system.out.println("image uploaded"); result_img=1; twitter4j.status status = t4jtwitter.updatestatus(staticdata.strtwitte+"\n"+url); int statusid = (int)status.getid(); //log.d(tag, "image uploaded, twitpic url " + url); } catch (exception e) { //log.e(tag, "failed send image"); result_img=0; system.out.println("failed send image"); e.printstacktrace(); }
Comments
Post a Comment