Code Monkey home page Code Monkey logo

android-volley's People

Contributors

amartinz avatar bendowski avatar brettchabot avatar chadj-at-google avatar cketcham avatar colincross avatar drewis avatar ducrohet avatar epicblood avatar evancharlton avatar fabianfrank avatar gamblore avatar jakewharton avatar jham avatar jjoslin avatar johnjohndoe avatar jpd236 avatar krschultz avatar maxtroy avatar maxzhouus avatar mcxiaoke avatar narayank avatar potyl avatar ralph-bergmann avatar samkirton avatar vovkab avatar wavesonics avatar xebozone avatar zdenda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-volley's Issues

Tags for 1.0.6, 1.05, etc

Unfortunately there seems to be no way to add tags via pull request, but it would be nice if there were tags on the newer releases of the project. I went through and found the commits in question if you want to just run this and push the tags up to the repo.

git tag -a "1.0.6" -m "versionCode:7" 8982c00; git tag -a "1.0.5" -m "versionCode:6"; git tag -a "1.0.4" -m "versionCode:5" cafdeb8; git tag -a "1.0.3" -m "versionCode:4" dfe0f37;

OutOfMemoryError

The client the exception thrown as follows:
java.lang.OutOfMemoryError
at com.android.volley.toolbox.DiskBasedCache.streamToBytes(DiskBasedCache.java:322)
at com.android.volley.toolbox.DiskBasedCache.readString(DiskBasedCache.java:540)
at com.android.volley.toolbox.DiskBasedCache.readStringStringMap(DiskBasedCache.java:562)
at com.android.volley.toolbox.DiskBasedCache$CacheHeader.readHeader(DiskBasedCache.java:403)
at com.android.volley.toolbox.DiskBasedCache.initialize(DiskBasedCache.java:156)
at com.android.volley.CacheDispatcher.run(CacheDispatcher.java:84)

Request some JSON format of data only.
Please help to analyze what's the problem?

Default charset for JSON responses should be UTF8

The JSON spec (RFC 46227) says:

"JSON text SHALL be encoded in Unicode.  The default encoding is UTF-8.".

If the server doesn't specify a charset in the response headers, Volley defaults to ISO_8859_1 (HttpHeaderParser.parseCharset()). Perhaps, in the case of JSON at least, it should default to UTF8 instead?

Why is Volley calling https://safebrowsing.google.com?

Library used:

compile 'com.mcxiaoke.volley:library:1.0.15'

Version used:

-----log------
D/Finsky (19660): [1] PackageVerificationReceiver.onReceive: Verification requested, id = 303
D/Finsky (19660): [1] PackageVerificationService.cancelVerificationIntent: Cancel active verification id=303
D/Finsky (19660): [1] 3.onErrorResponse: Verification id=303 error response com.android.volley.TimeoutError
D/Volley (19660): [1] Request.finish: 10091 ms: [ ] https://safebrowsing.google.com/safebrowsing/clientreport/download 0xc9395b26 NORMAL 42

java.lang.NegativeArraySizeException

I'm getting this error sometimes which causes my application to crash:

java.lang.NegativeArraySizeException: -450
at com.android.volley.toolbox.DiskBasedCache.streamToBytes(DiskBasedCache.java:322)
at com.android.volley.toolbox.DiskBasedCache.get(DiskBasedCache.java:118)
at com.android.volley.CacheDispatcher.run(CacheDispatcher.java:100)

Post Image to my Server

Hello, Is there a simple easy and reliable implement to send Image or a File to my server via POST ?

All the resources online, say,that volley does not include MultiPartJSONRequest:

But all the sample I tried from stackoverflow, does not work.

I just want to take a photo from the camera and post it to my server.

Anyone knows how to pass params to JsonObjectRequest in the newest version

As an old version of volley.jar. Other college made it and we pass params by following method:
@OverRide
public byte[] getBody() {
if (params != null && params.size() > 0) {
return encodeParameters(params, getParamsEncoding());
}
return null;
}

But we need to update volley, and find that this method was changed to private.

I also found that to override the method of getParams(), which did not work for me. the Method getBody of JsonObjectRequest is as following:

public byte[] getBody() {
try {
return mRequestBody == null ? null : mRequestBody.getBytes(PROTOCOL_CHARSET);
} catch (UnsupportedEncodingException uee) {
VolleyLog.wtf("Unsupported Encoding while trying to get the bytes of %s using %s",
mRequestBody, PROTOCOL_CHARSET);
return null;
}
}

so I cannot pass the params now.

POST request cached by default

The current implementation has a major problem. Caching is turned on by default for POST/PUT... requests.

We have this use case

You can GET from /layout

You can also send data to layout using POST.

The GET response is beeing cached for 15 minutes, so any POST data is not beeing sent at all and the cached GET response is beeing served. In our opiniion this is a major design flaw, if not a bug.

mShouldCache should default to false for all requests except GET request. Or even in general

How do you decide that the repo is pump to 1.0.0?

Hello,

I know you are setting this repo as mirror with the official volley project from Google, but how do you decide it's OK (or stable enough) to pump to versioning to 1.0.0 after each sync?

And how do you know it's now time to update the artifact to maven central too? We would like to use volley library in our project too using maven, but we would like to know if this is a "safe" artifact to trust.

Thanks,
Sam.

Remove "+" From Build.gradle in README

According to Android Studio/IntelliJ using + in:

compile 'com.mcxiaoke.volley:library:1.0.+'
// or 
compile 'com.mcxiaoke.volley:library:1.0.+@aar'

leads to unpredictable builds. So I propose changing it to:

compile 'com.mcxiaoke.volley:library:1.0.16'

The @aar is really not needed.

HTTP POST being fired multiple times even with retry policy == 0

When I need to make a POST request, I set retry policy = 0, but when the HTTP request hits the timeout, Volley sends another request (and if the timeout is hit again, it will send another one).

Looks like someone else is seeing the same issue here: http://stackoverflow.com/questions/29034735/volley-makes-duplicate-post-call-at-timeout-mark

I'm experiencing it with 1.0.8, 1.0.10, 1.0.15. I didn't try other releases.

This is a major issue because POSTs are by definition not idempotent and I can't find a workaround using Volley with POSTs.

java.lang.NullPointerException

at com.android.volley.toolbox.Volley.newRequestQueue(Volley.java:43)
at com.android.volley.toolbox.Volley.newRequestQueue(Volley.java:78)

API request sent two times

Server is slow. Volley is sending request two times i.e Its retrying to send request again.

I had solved the problem by overriding retry policy.

jsonObjReq.setShouldCache(false);

jsonObjReq.setRetryPolicy(new DefaultRetryPolicy(
(int) TimeUnit.SECONDS.toMillis(20),
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));

Please resolve this issue.

RequestQueue does not clear original url key from mWaitingRequests on redirects

In the case of redirects when requesting images, when you want to fetch the same image again, however the size of your NetworkImageView is different than in the first request, the image is not found. The server request is not fired either, because mWaitingRequests contains the original URL and hence the new request is ignored by Volley (the request queued forever).

Suggested fix is in RequestQueue.finish(Request<T> request) make the following change:

//String cacheKey = request.getCacheKey();
String originalKey = request.getOriginUrl();
String cacheKey = request.getCacheKey();
Queue<Request<?>> waitingRequests;
if (!originalKey.equals(cacheKey)) {
    waitingRequests = mWaitingRequests.remove(originalKey);
}

In order to test, you can create an app with a NetworkImageView that requests an image in (lets say) 50dpx50dp (NetworkImageViews size) and then on click of a button, an other NetworkImageView requests the same image in 100dpx100dp.

You can use the URL below to test which redirects to the actual image.
http://graph.facebook.com/592371158/picture

Application crashes on HTTP 404 status code

when server return HTTP status code 404 then application crashes.
new Response.ErrorListener() {

                @Override
                public void onErrorResponse(VolleyError error) {
                    Log.e(TAG, "Registration Error: " + error.getMessage());
                    Toast.makeText(getApplicationContext(),
                            error.getMessage(), Toast.LENGTH_LONG).show();
                    hideDialog();
                }
            })

in this method and return null Toast

NullPointerException in ExecutorDelivery

I just got this crash stack trace from our app in production:

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.android.volley.Response.isSuccess()' on a null object reference
at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:98)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

Perhaps we should protect mResponse and mRequest with a null check first?

Image disappears in CursorAdapter

I'm using volley to load images in my cursor adapter. The images successfully load, however, when I scroll away, and scroll back up the image disappears1

Here is the relevant code:

In the array initializer:

mImageLoader = MyApplication.getInstance().getImageLoader();

And in my bindView method:

storyImage.setImageUrl(imageURL, mImageLoader);

The mImageLoader initialization references to MyApplication.class, which can be found here2

java.lang.OutOfMemoryError

I'm trying to get a big JSON from a backend using Volley. I'm using a JsonObjectRequest and a singleton Volley request queue to do it. This my source:

JsonObjectRequest request = new JsonObjectRequest(Request.Method.GET,
                URL, new Response.Listener<JSONObject>() {
            @Override
            public void onResponse(JSONObject response) {
                apiResponse.response(response, null);
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {    
                apiResponse.response(null, error);
            }
        });
        mRequestQueue.add(request);

But always I get this Exception:

java.lang.OutOfMemoryError
        at java.util.HashMap.makeTable(HashMap.java:569)
        at java.util.HashMap.doubleCapacity(HashMap.java:589)
        at java.util.HashMap.put(HashMap.java:419)
        at org.json.JSONObject.put(JSONObject.java:263)
        at org.json.JSONTokener.readObject(JSONTokener.java:385)
        at org.json.JSONTokener.nextValue(JSONTokener.java:100)
        at org.json.JSONTokener.readArray(JSONTokener.java:430)
        at org.json.JSONTokener.nextValue(JSONTokener.java:103)
        at org.json.JSONTokener.readObject(JSONTokener.java:385)
        at org.json.JSONTokener.nextValue(JSONTokener.java:100)
        at org.json.JSONObject.<init>(JSONObject.java:155)
        at org.json.JSONObject.<init>(JSONObject.java:172)
        at com.android.volley.toolbox.JsonObjectRequest.parseNetworkResponse(JsonObjectRequest.java:103)
        at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:123)

Do you have any idea why it's crashing? Could it be related to the big size of my JSON response?

jar file of project

Hello

I need jar file of this project for us on my app on , at this moment I use eclipse and cant move project to android studio. any link for download jar file?

thanks

connectedCheck failed when used as module.

I used this library as module like this.

dependencies {
    compile project(':modules:volley')
}

But when I execute $ ./gradlew connectedCheck an error occurred.

WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for debugUnitTest as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.3 is ignored for debugUnitTest as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for releaseUnitTest as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.3 is ignored for releaseUnitTest as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:modules:volley:compileLint
:modules:volley:copyReleaseLint UP-TO-DATE
:modules:volley:mergeReleaseProguardFiles UP-TO-DATE
:modules:volley:preBuild UP-TO-DATE
:modules:volley:preReleaseBuild UP-TO-DATE
:modules:volley:checkReleaseManifest
:modules:volley:prepareReleaseDependencies
:modules:volley:compileReleaseAidl UP-TO-DATE
:modules:volley:compileReleaseRenderscript UP-TO-DATE
:modules:volley:generateReleaseBuildConfig UP-TO-DATE
:modules:volley:generateReleaseAssets UP-TO-DATE
:modules:volley:mergeReleaseAssets UP-TO-DATE
:modules:volley:generateReleaseResValues UP-TO-DATE
:modules:volley:generateReleaseResources UP-TO-DATE
:modules:volley:packageReleaseResources UP-TO-DATE
:modules:volley:processReleaseManifest UP-TO-DATE
:modules:volley:processReleaseResources UP-TO-DATE
:modules:volley:generateReleaseSources UP-TO-DATE
:modules:volley:compileReleaseJava UP-TO-DATE
:modules:volley:processReleaseJavaRes UP-TO-DATE
:modules:volley:packageReleaseJar UP-TO-DATE
:modules:volley:compileReleaseNdk UP-TO-DATE
:modules:volley:packageReleaseJniLibs UP-TO-DATE
:modules:volley:packageReleaseLocalJar UP-TO-DATE
:modules:volley:packageReleaseRenderscript UP-TO-DATE
:modules:volley:bundleRelease UP-TO-DATE
:app:prepareComAfollestadMaterialDialogs0755Library UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72220Library UP-TO-DATE
:app:prepareComAndroidSupportCardviewV72220Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72220Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42220Library UP-TO-DATE
:app:prepareComEchoHolographlibrary10Library UP-TO-DATE
:app:prepareComFortysevendegSwipelistviewSwipelistview10SNAPSHOTLibrary UP-TO-DATE
:app:prepareComGetbaseFloatingactionbutton190Library UP-TO-DATE
:app:prepareComGithubGanfraMaterialSpinner110Library UP-TO-DATE
:app:prepareComGithubNavasmdcMaterialDesign15Library UP-TO-DATE
:app:prepareComMcxiaokeVolleyVolley1016Library UP-TO-DATE
:app:prepareComRengwuxianMaterialedittextLibrary213Library UP-TO-DATE
:app:prepareComWdullaerMaterialdatetimepicker131Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:compileDebugJava UP-TO-DATE
:app:preDexDebug UP-TO-DATE
:app:dexDebug UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:validateDebugSigning
:app:packageDebug UP-TO-DATE
:app:zipalignDebug UP-TO-DATE
:app:assembleDebug UP-TO-DATE
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:compileDebugAndroidTestNdk UP-TO-DATE
:app:prepareDebugAndroidTestDependencies
:app:compileDebugAndroidTestAidl UP-TO-DATE
:app:processDebugAndroidTestManifest UP-TO-DATE
:app:compileDebugAndroidTestRenderscript UP-TO-DATE
:app:generateDebugAndroidTestBuildConfig UP-TO-DATE
:app:generateDebugAndroidTestAssets UP-TO-DATE
:app:mergeDebugAndroidTestAssets UP-TO-DATE
:app:generateDebugAndroidTestResValues UP-TO-DATE
:app:generateDebugAndroidTestResources UP-TO-DATE
:app:mergeDebugAndroidTestResources UP-TO-DATE
:app:processDebugAndroidTestResources UP-TO-DATE
:app:generateDebugAndroidTestSources UP-TO-DATE
:app:compileDebugAndroidTestJava UP-TO-DATE
:app:preDexDebugAndroidTest UP-TO-DATE
:app:dexDebugAndroidTest UP-TO-DATE
:app:processDebugAndroidTestJavaRes UP-TO-DATE
:app:packageDebugAndroidTest UP-TO-DATE
:app:assembleDebugAndroidTest UP-TO-DATE
:app:connectedAndroidTest
:app:connectedCheck
:modules:volley:copyDebugLint UP-TO-DATE
:modules:volley:mergeDebugProguardFiles UP-TO-DATE
:modules:volley:preDebugBuild UP-TO-DATE
:modules:volley:checkDebugManifest
:modules:volley:prepareDebugDependencies
:modules:volley:compileDebugAidl UP-TO-DATE
:modules:volley:compileDebugRenderscript UP-TO-DATE
:modules:volley:generateDebugBuildConfig UP-TO-DATE
:modules:volley:generateDebugAssets UP-TO-DATE
:modules:volley:mergeDebugAssets UP-TO-DATE
:modules:volley:generateDebugResValues UP-TO-DATE
:modules:volley:generateDebugResources UP-TO-DATE
:modules:volley:packageDebugResources UP-TO-DATE
:modules:volley:processDebugManifest UP-TO-DATE
:modules:volley:processDebugResources UP-TO-DATE
:modules:volley:generateDebugSources UP-TO-DATE
:modules:volley:compileDebugJava UP-TO-DATE
:modules:volley:processDebugJavaRes UP-TO-DATE
:modules:volley:packageDebugJar UP-TO-DATE
:modules:volley:compileDebugNdk UP-TO-DATE
:modules:volley:packageDebugJniLibs UP-TO-DATE
:modules:volley:packageDebugLocalJar UP-TO-DATE
:modules:volley:packageDebugRenderscript UP-TO-DATE
:modules:volley:bundleDebug UP-TO-DATE
:modules:volley:assembleDebug UP-TO-DATE
:modules:volley:preDebugAndroidTestBuild UP-TO-DATE
:modules:volley:compileDebugAndroidTestNdk UP-TO-DATE
:modules:volley:prepareComAndroidSupportTestEspressoEspressoCore20Library UP-TO-DATE
:modules:volley:prepareComAndroidSupportTestEspressoEspressoIdlingResource20Library UP-TO-DATE
:modules:volley:prepareComAndroidSupportTestTestingSupportLib01Library UP-TO-DATE
:modules:volley:prepareDebugAndroidTestDependencies
:modules:volley:compileDebugAndroidTestAidl UP-TO-DATE
:modules:volley:processDebugAndroidTestManifest UP-TO-DATE
:modules:volley:compileDebugAndroidTestRenderscript UP-TO-DATE
:modules:volley:generateDebugAndroidTestBuildConfig UP-TO-DATE
:modules:volley:generateDebugAndroidTestAssets UP-TO-DATE
:modules:volley:mergeDebugAndroidTestAssets UP-TO-DATE
:modules:volley:generateDebugAndroidTestResValues UP-TO-DATE
:modules:volley:generateDebugAndroidTestResources UP-TO-DATE
:modules:volley:mergeDebugAndroidTestResources UP-TO-DATE
:modules:volley:processDebugAndroidTestResources UP-TO-DATE
:modules:volley:generateDebugAndroidTestSources UP-TO-DATE
:modules:volley:compileDebugAndroidTestJava UP-TO-DATE
:modules:volley:preDexDebugAndroidTest UP-TO-DATE
:modules:volley:dexDebugAndroidTest UP-TO-DATE
:modules:volley:processDebugAndroidTestJavaRes UP-TO-DATE
:modules:volley:validateDebugSigning
:modules:volley:packageDebugAndroidTest
Error: duplicate files during packaging of APK /Users/yasudayousuke/Documents/job/finc/FiNC-Android/modules/volley/build/outputs/apk/volley-debug-androidTest-unaligned.apk
    Path in archive: LICENSE.txt
    Origin 1: /Users/yasudayousuke/.gradle/caches/modules-2/files-2.1/junit/junit-dep/4.10/64417b3bafdecd366afa514bd5beeae6c1f85ece/junit-dep-4.10.jar
    Origin 2: /Users/yasudayousuke/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.1/860340562250678d1a344907ac75754e259cdb14/hamcrest-core-1.1.jar
You can ignore those files in your build.gradle:
    android {
      packagingOptions {
        exclude 'LICENSE.txt'
      }
    }
:modules:volley:packageDebugAndroidTest FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':modules:volley:packageDebugAndroidTest'.
> Duplicate files copied in APK LICENSE.txt
    File 1: /Users/yasudayousuke/.gradle/caches/modules-2/files-2.1/junit/junit-dep/4.10/64417b3bafdecd366afa514bd5beeae6c1f85ece/junit-dep-4.10.jar
    File 2: /Users/yasudayousuke/.gradle/caches/modules-2/files-2.1/junit/junit-dep/4.10/64417b3bafdecd366afa514bd5beeae6c1f85ece/junit-dep-4.10.jar


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 18.399 secs

this repository is cloned as projectRoot/modules/volley.

JsonArrayRequest is missing a constructor

JsonArrayRequest is missing the contstructor to specify request type, url, payload, and listener.

JsonObjectRequest has both constructers, and JsonRequest (the parent) has the proper constructer.

Volley ImageCache

Good day to you!

Is there any way to cache images for a custom period of time, but not for the time application is in memory. Cause every time I swipe out the app from the memory, all image requests shoud be done again. I'v tried to customize library and enforce cache time in Entry class. I'v loged the CacheDispatcher, and when the app starts after deletion from memory, dispatcher checks for the images to be cached by the key, and every time the listview upload a view with NetworkImage to the screen, dispatcher checks for the same url of image and returns false. But every image in my list is unic

Thanks

NetworkImageView setBitmap gets overriden on layout

This is for the Volley team, not your fork, but when looking at the overhead for submitting a patch to Google my eyes just kinda of glazed over so I thought I would put this somewhere it might be useful.

If you're trying to do this, which many people are:

imageLoader.get(data.getImageUrl(), new ImageLoader.ImageListener(){
            @Override
            public void onResponse(ImageLoader.ImageContainer response, boolean isImmediate) {
                Log.e("TAG",response.toString());
                if(response.getBitmap() != null){
                    Bitmap b = response.getBitmap();
                    p.imageView.setImageBitmap(response.getBitmap());
                }
            }

            @Override
            public void onErrorResponse(VolleyError error) {

            }
        });

and imageView is a NetworkImageView, the bitmap will trigger an onLayout change and consequently the image will be nulled out on the view. NetworkImageView's should stop trying to get data or changing their content is someone manually is using them as an ImageView.

For those of you who have come across this, you can always just set the url to be something bad for the NetworkImageView (like "NONETWORK") and it will gracefully error out and you can use it manually, but it seems like if you're going to extend from ImageView you shouldn't break the parent class's use cases.

POST params and headers not working

Hi,

I try to make a POST request with params and custom headers, but it not worked.
When I try to make a GET request with my custom headers and URL params, it works.

I use a JsonObjectRequest and I try to add my POST params in a JSONObject or in the override method getParams but none of them work.

Can you help me?
Thanks in advance.

VolleyError is not Serializable

Volley class com.android.volley.VolleyError extends java.lang.Exception. Exception class is Serializable and so VolleyError is. But VolleyError contains a NetworkResponse instance which is not Serializable.

Serializing a VolleyError instance fails with a NotSerializableException.

Cancel all tag comparison

I have observed that cancelAll(Object tag) is using "==" to compare tags. This only works if you use the same static object as a tag for both cancel and requests. We use fragments simple names as tags and have one base fragment that ensures requests are cancelled if the fragment is changed. With == not all requests are cancelled since the base class uses instance reference to the class name and not static access.

I would suggest changing it to

return (request.getTag() !=null && request.getTag().equals(tag));

Mavenize

Can we mavenize this and get it on central asap?

JsonObjectRequest does not take null for jsonRequest/requestBody

It is not possible to to pass null into the constructor (when using another Method than GET) of the JsonObjectRequest since the new constructors have been added, because multiple constructors apply. Can another constructor for an empty request body be added?

-- never mind ... since it does not make sence to use something else than GET without a requestBody

OOM

Process: com.playsport.ps, PID: 25717
java.lang.OutOfMemoryError: pthread_create (stack size 16384 bytes) failed: Try again(Heap Size=19488KB, Allocated=16991KB)
at java.lang.VMThread.create(Native Method)
at java.lang.Thread.start(Thread.java:1063)
at com.android.volley.RequestQueue.start(RequestQueue.java:141)
at com.android.volley.toolbox.Volley.newRequestQueue(Volley.java:66)
at com.android.volley.toolbox.Volley.newRequestQueue(Volley.java:78)
at com.playsport.ps.ServerApi.(ServerApi.java:32)
at com.playsport.ps.DataHelper.(DataHelper.java:12)
at com.playsport.ps.MainActivity.getHeadTitle(MainActivity.java:3672)
at com.playsport.ps.MainActivity.access$000(MainActivity.java:88)
at com.playsport.ps.MainActivity$7.run(MainActivity.java:447)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5872)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:674)
at dalvik.system.NativeStart.main(Native Method)

Who has same problem can help me?

NullPointerException with ImageRequest

Here is my stacktrace can't reporduce it on my devices though :(

java.lang.NullPointerException
at android.graphics.Bitmap.createBitmap(Bitmap.java:622)
at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:487)
at com.android.volley.toolbox.ImageRequest.doParse(ImageRequest.java:169)
at com.android.volley.toolbox.ImageRequest.parseNetworkResponse(ImageRequest.java:126)
at com.android.volley.CacheDispatcher.run(CacheDispatcher.java:118)

Is there a workaround or this need to be fixed in library ?

Feature Request: Support for Request Execution Context

HttpClient supports a concept of a context that can be used to share mapped attributes about a series of calls:
http://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/org/apache/http/protocol/HttpContext.html?is-external=true

This is useful for sharing networking level information like
redirect locations and counts, often needed in other places like resolving relative URLs
for HTML rendering.

Volley current uses a single argument execute method in the HttpClient networking stack:
https://github.com/mcxiaoke/android-volley/blob/master/src/com/android/volley/toolbox/HttpClientStack.java#L83
http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/client/HttpClient.html#execute(org.apache.http.client.methods.HttpUriRequest)

The one with an extra HttpContext argument could be used, however, to allow the functionality:
http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/client/HttpClient.html#execute(org.apache.http.client.methods.HttpUriRequest,%20org.apache.http.protocol.HttpContext)

Anyone knows how to pass params to JsonObjectReques in the newest version.

As an old version of volley.jar. we pass params by following method:
@OverRide
public byte[] getBody() {
if (params != null && params.size() > 0) {
return encodeParameters(params, getParamsEncoding());
}
return null;
}

But we need to update volley, and find that this method was changed to private.

I also found that to override the method of getParams(), which did not work for me. the Method getBody of JsonObjectRequest is as following:

public byte[] getBody() {
try {
return mRequestBody == null ? null : mRequestBody.getBytes(PROTOCOL_CHARSET);
} catch (UnsupportedEncodingException uee) {
VolleyLog.wtf("Unsupported Encoding while trying to get the bytes of %s using %s",
mRequestBody, PROTOCOL_CHARSET);
return null;
}
}

so I cannot pass the params now.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.