ogrebgr / android_volley_examples Goto Github PK
View Code? Open in Web Editor NEWProject with examples how to use the new Volley networking framework
License: Apache License 2.0
Project with examples how to use the new Volley networking framework
License: Apache License 2.0
I'm a beginner Android developer and I've barely been exposed to basic Java before. As a result, I'm finding it difficult to understand some of these examples.
For instance I'm reading through "android_volley_examples / src / com / github / volley_examples / Act_SimpleRequest.java" and trying to figure out what you're doing and what parts I can apply to my own code. Within the code, there's interactions with the UI, additional function calls, and new functions added further down the file. Figuring out these parts took a while, and figuring out more of the examples might take even longer.
Could you add some simple comments that summarize what's going on to some of your examples?
don't work if the response is 204 with out content
gives the error
int memClass = ((ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE)).getMemoryClass();
final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024);
Log.e("TAG","maxMemory:"+maxMemory+",memClass:"+memClass);
Your units are wrong?
see:http://developer.android.com/training/displaying-bitmaps/cache-bitmap.html
Hi:
Could you write a file upload Request , Thank you !
I was wondering if you could add a synchronous example to your set that uses RequestFuture
and future.get(4, TimeUnit.SECONDS)
I followed the sample in the source code of the RequestFuture but future.get() blocks first and then times out with no result!
Thanks
Hi,
if i try with API level = 15 i have this error:
1496-1510/com.package E/Volley﹕ [81] NetworkDispatcher.run: Unhandled exception java.lang.IllegalArgumentException: SSL context may not be null
Hi,
Trying to use new httpClient with PoolingHttpClientConnectionManager. Having so many issue.
Is there any way that I can get source of khandroid-httpclient-4.2.3.jar?
Regards,
Mike
Hello:
Performance comparison of khandroid-httpclient-4.2.3.jar and ok-http.jar.
which one is better.
Hi,
Thanks for sharing such a good library. I used this in some android apps contains JSON Request and Response but now i am working on GraphQL so, it is different from JSON. Do you have chance to share some sample code how to implement volley using GraphQL
Hi,
I wanted to use your library to better understand how I can use SSL with Volley, the only problem is that I got exception on my 4.1.2 and 4.4.4 emulators. The real problem is that these exceptions aren't same on both devices : I receive a javax.net.ssl.SSLPeerUnverifiedException on the 4.1.2 (which seems quite logical because it's a self-signed certificate) but on the 4.4.4 it's quite critical because I'm receiving a java.net.UnknownHostException. I checked and the address is ok : it's yours!
Why does it return the exception? I've followed through your codes.
Logs
Caused by: java.lang.IllegalStateException: RequestQueue Not Initialized at com.capstone.artink.app.CustomVolley.getRequestQueue(CustomVolley.java:29) at com.capstone.artink.Dashboard.onCreate(Dashboard.java:101) at android.app.Activity.performCreate(Activity.java:5008) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) at android.app.ActivityThread.access$600(ActivityThread.java:130) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4745) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) at dalvik.system.NativeStart.main(Native Method)
This is the CustomVolley(MyVolley).
package com.capstone.artink.app;
import android.content.Context;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.Volley;
import com.capstone.artink.utils.LruBitmapCache;
public class CustomVolley{
private static RequestQueue mRequestQueue;
private static ImageLoader mImageLoader;
private CustomVolley(){
}
static void init(Context context){
mRequestQueue = Volley.newRequestQueue(context);
mImageLoader = new ImageLoader(mRequestQueue, new LruBitmapCache());
}
public static RequestQueue getRequestQueue(){
if(mRequestQueue != null){
return mRequestQueue;
}
else { throw new IllegalStateException("RequestQueue Not Initialized"); }
}
public static ImageLoader getImageLoader(){
if(mImageLoader != null){
return mImageLoader;
}
else
{ throw new IllegalStateException("ImageLoader Not Initialized"); }
}
}
This is the error on Dashboard.java line 101
RequestQueue queue = CustomVolley.getRequestQueue();
final String user = username;
final String type = usertype;
JsonObjectRequest myRequest = new JsonObjectRequest(Request.Method.GET,
Config.ENT_PROFILE_URL,
null,
RequestSuccessListener(),
RequestFailedListener()) {
};
queue.add(myRequest);
I think I posted at the wrong file, it's supposed to be at Act_JsonRequest.java
Hi,
i try to do simple JsonRequest with TLS/SSL and i write this code:
// Replace R.raw.clienttruststore with your trust keystore in this import server cert
InputStream trustKeyStore = getResources().openRawResource(R.raw.clienttruststore);
// Replace R.raw.client with your client keystore
InputStream keyStore = getResources().openRawResource(R.raw.client);
RequestQueue queue = Volley
.newRequestQueue(Act_JsonRequest.this,
new ExtHttpClientStack(new SslHttpClient(trustKeyStore, "secret", 443, keyStore)));
JsonObjectRequest myReq = new JsonObjectRequest(Method.GET,
"https://192.168.1.4:8443/REST/app/generali/getA",null,
createMyReqSuccessListener(),
createMyReqErrorListener()){
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
return createBasicAuthHeader("1", "2");
}};
queue.add(myReq);
}
});
But not work, if i try with StringRequest work..but i want Json..you have any idea?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.