@@ -14,16 +14,16 @@ Tested in Android 5.1, 6.0.
1414 <dependency >
1515 <groupId >com.panxw.volley</groupId >
1616 <artifactId >library</artifactId >
17- <version >1.0.1 </version >
17+ <version >1.0.2 </version >
1818 </dependency >
1919
2020#####for Gradle
2121 dependencies {
22- compile 'com.panxw.volley:library:1.0.1 '
22+ compile 'com.panxw.volley:library:1.0.2 '
2323 }
2424
2525#####latest jars for download
26- [ com.panxw.volley-1.0.1 -classes.jar] ( https://github.com/panxw/android-volley-manager/blob/master/release/com.panxw.volley-1.0.1 -classes.jar?raw=true )
26+ [ com.panxw.volley-1.0.2 -classes.jar] ( https://github.com/panxw/android-volley-manager/blob/master/release/com.panxw.volley-1.0.2 -classes.jar?raw=true )
2727
2828##Sample
2929#####init RequestManager in your Application
@@ -42,67 +42,78 @@ Tested in Android 5.1, 6.0.
4242
4343#####use RequestManager to load data
4444 public class MainActivity extends Activity implements RequestListener {
45- private static final String OUT_FILE = "upload.txt";
46- private static final String OUT_DATA = "sadf464764sdf3ds1f3adsf78921355u2390q3rtheslafkhsdafhreasof";
47- private static final String POST_URL = "http://allthelucky.ap01.aws.af.cm/memoServer ";
45+
46+ private static final String TAG = "VolleyTest";
47+
48+ private static final String GET_URL = "http://www.panxw.com/about.html";
49+
50+ private static final String POST_URL = "http://www.panxw.com/index.php";
51+
4852 private static final String POST_JSON = "{\"action\":\"test\", \"info\":\"hello world\"}";
49- private static final String GET_URL = "https://raw.githubusercontent.com/panxw/android-volley-manager/master/test.txt ";
53+
54+ private static final String OUT_FILE = "upload.txt";
55+
56+ private static final String OUT_DATA = "df464764sdf3ds1f3adsf789213557r12-34912-482130487321";
57+
5058 private static final String UPLOAD_URL = "http://www.splashpadmobile.com/upload.php";
59+
5160 private LoadController mLoadController = null;
52-
61+
5362 @Override
5463 protected void onCreate(Bundle savedInstanceState) {
5564 super.onCreate(savedInstanceState);
5665 setContentView(R.layout.activity_main);
57-
58- this.testPost();
66+
5967 this.testGet();
68+ this.testPost();
6069 this.testFileUpload();
6170 }
62-
63- private void testPost() {//test post
64- mLoadController = RequestManager.getInstance().post(POST_URL, POST_JSON, this, 0);
65- }
66-
67- private void testGet() {//test GET
71+
72+ private void testGet() {
6873 mLoadController = RequestManager.getInstance().get(GET_URL, this, 1);
6974 }
70-
71- private void testFileUpload() {//test POST(with file) in RequestMap
75+
76+ private void testPost() {
77+ mLoadController = RequestManager.getInstance().post(POST_URL, POST_JSON,
78+ this, 0);
79+ }
80+
81+ private void testFileUpload() {
7282 MainActivity.prepareFile(this);
73-
83+
7484 RequestMap params = new RequestMap();
7585 File uploadFile = new File(this.getFilesDir(), OUT_FILE);
7686 params.put("uploadedfile", uploadFile);
7787 params.put("share", "1");
78-
79- mLoadController = RequestManager.getInstance().post(UPLOAD_URL, params, this, 2);
88+
89+ mLoadController = RequestManager.getInstance().post(UPLOAD_URL, params,
90+ this, 2);
8091 }
81-
92+
8293 @Override
8394 public void onSuccess(String response, Map<String, String> headers,
8495 String url, int actionId) {
85- System.out.println( "actionId:" + actionId + ", OnSucess!\n" + response);
96+ Log.d(TAG, "actionId:" + actionId + ", OnSucess!\n" + response);
8697 }
87-
98+
8899 @Override
89100 public void onError(String errorMsg, String url, int actionId) {
90- System.out.println( "actionId:" + actionId + ", onError!\n" + errorMsg);
101+ Log.d(TAG, "actionId:" + actionId + ", onError!\n" + errorMsg);
91102 }
92-
103+
93104 @Override
94105 public void onRequest() {
95- System.out.println( "request send...");
106+ Log.d(TAG, "request send...");
96107 }
97-
108+
98109 @Override
99110 public void onBackPressed() {
100111 super.onBackPressed();
101112 if (mLoadController != null) {
102113 mLoadController.cancel();
103114 }
104115 }
105-
116+
106117 private static void prepareFile(Context context) {
107118 FileOutputStream fos = null;
108119 try {
@@ -124,6 +135,7 @@ Tested in Android 5.1, 6.0.
124135 }
125136 }
126137 }
138+
127139 }
128140
129141####Author
0 commit comments