loopj

How to wait for two Async HTTP request complete with loopj HTTP library

拈花ヽ惹草 提交于 2021-02-08 05:20:24
问题 My case is that I need to get two sets of data from sever with two HTTP get request, then process them together. I'm using loopj's http library to do the task. The problem is that since loopj's http is Async, which means I can't determine when they will be complete and which will complete first.They all have their own onSuccess function. I tried to put a boolean flag into each of them, and make the calling activity check the change of AND operation of these two boolean, but seems if I make

Facing difficulty while sending mp3 file from Android to Server

删除回忆录丶 提交于 2020-01-25 14:30:46
问题 I'am trying to send a mp3 file from my Android application to Server. I'am using this method android async http to send mp3 file. This is my code. try { params1.put("file", new ByteArrayInputStream(MeetingFragment.mediafile)); } catch (FileNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } AsyncClientHandler.post("events/Uploadrecording/5", params1, new AsyncHttpResponseHandler() { @Override public void onFailure(int statusCode, Throwable error, String content)

Android - cz.msebera.android.httpclient.entity.ByteArrayEntity required: org.apache.http.HttpEntity

旧巷老猫 提交于 2020-01-06 08:12:45
问题 I am using loopj AsyncHttpClient to call web services. I am trying register a user. So I need to send JSON data to Web Service. ByteArrayEntity entity = new ByteArrayEntity(json.toString().getBytes("UTF-8")); entity.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); client.post(getApplicationContext(), "http://10.0.3.2:8080/WebService/rest/user/insert", entity, new JsonHttpResponseHandler(){ When I put cursor on the entity in client.post line it gives this error. cz

Self-signed certificate and loopj for Android

不问归期 提交于 2019-12-31 08:13:09
问题 I'm trying to use loopj for making async HTTP requests. Works great, except when I try to access https site with self-signed cert. I get javax.net.ssl.SSLPeerUnverifiedException: No peer certificate. I guess the default ssl options can be overriding using setSSLSocketFactory(SSLSocketFactory sslSocketFactory) method, but I'm not sure how to do it or it might not be the right way at all. Please suggest how can I solve this issue ? 回答1: You do it almost exactly the same as explained here for

SmartImageVIew, I would like to force refresh (and not caching)

不羁的心 提交于 2019-12-25 02:54:07
问题 I am using this useful class that allow smart online downloading of images (from the loopj guys). It works fine, but i cannot force the "refresh" in the case of same name images that could have been changed in the server (example: I update my profile picture). So at the moment I am forcing the brutal delete of my app cache dir before the setImageUrl(). It works, and some FileNotFoundException is raised. No big deal, but I hate having something that works "without really working", I don't know

Loopj timeout exception in Android

北战南征 提交于 2019-12-25 02:48:21
问题 I am having a strange problem with Loopj Async HTTP library. I sometimes get the response using GET or POST, sometimes the response comes after a long time, some times the response does not come at all. This happens only when wifi is used. I have used loopj in so many projects and those work fine with wifi but not this project. When I use my mobile data 3G connection, always the response comes. I have overridden the onFaliure method and this is what I get when the response from server does

AsyncHttpRequest POST not triggering callbacks (android-async-http by loopj)

ぃ、小莉子 提交于 2019-12-21 04:40:55
问题 I'm trying to send a POST to a server using loopj's async http library. The following code is pretty standard but I can't get it to work. I have debugged quite a bit and have checked the following: The URL is correct. The params are correct and they are stored correctly into the params variable. It appears that when HttpResponse response = client.execute(request, context); is called in AsyncHttpRequest.makeRequest() the request doesn't contain any params: EDIT : After looking at the code a

How to use loopJ SyncHttpClient for synchronous calls?

心不动则不痛 提交于 2019-12-20 15:22:51
问题 I have been stuck on this for two days now, finally decided to post here. I see loopj library being used for Async Calls and with lots of examples and explanations. But since I cannot use async calls in IntentSerive in Android I am forced to use SyncHttpClient, but it does not seem to work as only the onFailure callback is called when I use SyncHttpClient. There are no examples of using SyncHttpClient also in the documentation. This issue is also discussed here. So can someone give the right

Create File from Uri type android

故事扮演 提交于 2019-12-18 06:26:49
问题 I'm trying to select image from gallery then convert this image to File and send it via HttpPost but I'm getting always FileNotFoundException . This my Code : Selecting the photo 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

Create File from Uri type android

邮差的信 提交于 2019-12-18 06:24:04
问题 I'm trying to select image from gallery then convert this image to File and send it via HttpPost but I'm getting always FileNotFoundException . This my Code : Selecting the photo 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