HttpURLConnection con = null;
Response response = new Response();
String TAG = "HttpConHandler";
try{
/*
* IMPORTANT:
* User SHOULD provide URL Encoded Parms
*/
Log.p(TAG, "URL="+ urlStr);
String q=httpHeaders.get("Authorization");
URL url = new URL(urlStr);
con = (HttpURLConnection) url.openConnection();
con.setRequestProperty("Authorization", q);
con.setRequestProperty("GData-Version", "3.0");
Hi I am getting java.lang.IllegalStateException: Cannot set method after connection is made
error when setRequestProperty
method is called ,but when I call this method before connection I get NullPointerException
because con
is null. What can I do to solve this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…