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");
嗨,我在调用方法时遇到java.lang.IllegalStateException: Cannot set method after connection is made
错误setRequestProperty
,但是当我在连接之前调用此方法时,我得到了NullPointerException
,因为con
它是空的。我能做些什么来解决这个问题?