Tag: loopj

从Uri类型android创建文件

我正在尝试从库中选择图像然后将此图像转换为文件并通过HttpPost发送它,但我总是得到FileNotFoundException 。 我的代码: 选择照片 public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == Activity.RESULT_OK) { if (requestCode == 1) { // currImageURI is the global variable I’m using to hold the content: currImageURI = data.getData(); //Save the currImageUri (URI type) to global variable. photosHolder.getInstance().setOneIm(currImageURI); } } } 转换照片 // First Try File […]

Android – loopJ AsyncHttpClient返回响应onFinish或onSuccess

我正在寻找一种方法来返回我在loopJ AsyncHttpClient onFinish或onSuccess或onFailure中得到的响应。 截至目前,我有这段代码: **jsonParse.java file** public class jsonParse { static JSONObject jObj = null; static String jsonString = “”; AsyncHttpClient client; public JSONObject getJSONObj() { RequestParams params; params = new RequestParams(); params.add(“username”, “user”); params.add(“password”, “password”); client = new AsyncHttpClient(); client.post(“http://example.com”, params, new TextHttpResponseHandler() { @Override public void onSuccess(int i, Header[] headers, String response) { […]