Have the following code:
if (post) {
HttpPost request = new HttpPost(url);
Log.i(TAG, "Posting URL: " + url);
} else {
HttpGet request = new HttpGet(url);
Log.i(TAG, "Getting URL: " + url);
}
...
if (signed) {
OAuthConsumer consumer = getConsumer(prefs);
consumer.sign(request); // here is the error
}
How to fix it?
You need to define your request outside of the
ifstatement:otherwise your the scope of your
requestvariable is limited to the body of theifstatement.