Unknown host Exception while calling method " twitter.getOAuthRequestToken()"
I am trying to integrate twitter api using library twitter4j-core-2.1.1-SNAPSHOT.jar. But i am getting error Unknown host Exception from 2 days. here is the part of code(index by .....(1)) that is generating Exception.
public String beginAuthorization() {
//showDialog("Authorization...........");
//new AuthorizationTask(this).execute("Authorize");
try {
if (null == currentRequestToken) {
Log.e("begin","i am here the line below is throwing excetion");
currentRequestToken = twitter.getOAuthRequestToken();............(1)
}
Log.e("beginAuthorization", currentRequest开发者_Go百科Token.getAuthorizationURL());
return currentRequestToken.getAuthorizationURL();
} catch (TwitterException e) {
e.printStackTrace();
}
return null;
}
anyone have idea about this problem???
thank u in advance
- Did you put permission in xml manifest?
- Have you tried opening a browser in android and going to twitter.com?
- Try to connect to any url from the code and see what happens.
This is what I'd forgotten to include in my AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" />
精彩评论