From 095d5f38c2822de949f04389f2ae206cad704fea Mon Sep 17 00:00:00 2001 From: Vishnu Sivadas Date: Tue, 23 Jun 2020 22:07:11 +0530 Subject: [PATCH 1/4] Update README.md --- README.md | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 00b71e6..820c99e 100644 --- a/README.md +++ b/README.md @@ -21,9 +21,10 @@ allprojects { } ``` ## Methods and how to use them +### Read Data From a URL - FetchData.class 1. Create an object for FetchData class, pass the URL as argument. Don't forget to import the class. ``` -FetchData fetchData = new FetchData("https://projects.vishnusivadas.com/AdvancedHttpURLConnection/readtest.php"); +FetchData fetchData = new FetchData("https://projects.vishnusivadas.com/AdvancedHttpURLConnection/readTest.php"); ``` 2. Start the fetching data. ``` @@ -31,7 +32,39 @@ fetchData.start(); ``` 3. Get the result as string. ``` -String data = fetchData.getValue(); +String data = fetchData.getResult(); +``` + +### Write data with POST and GET methods - PutData.class +1. Creating array for parameters + ``` + String[] param = new String[2]; + param[0] = "param-1"; + param[1] = "param-2"; + ``` + _Use any parameter name that you like._ + +2. Creating array for data + ``` + String[] data = new String[2]; + data[0] = "data-1"; + data[1] = "data-2"; + ``` + _Add as many as data and parameters as you like. Make sure number of parameters is equal to number of data. Also add then in exact order._ + +3. Create an object for PutData class, pass the URL as argument. Don't forget to import the class. +``` +PutData putData = new PutData("https://projects.vishnusivadas.com/AdvancedHttpURLConnection/putDataTest.php", "POST", param, data); +``` + +4. Start the putData process. +``` +putData.start(); +``` + +5. Get the result as string. +``` +String data = putData.getResult(); ``` This is just like a pre-release version there are lot of other features coming soon. From 7da46c2084a9ab0a96da70e0c20a9e87ede42fea Mon Sep 17 00:00:00 2001 From: Vishnu Sivadas Date: Tue, 23 Jun 2020 22:08:43 +0530 Subject: [PATCH 2/4] Update README.md --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 820c99e..78a3c66 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,8 @@ allprojects { ### Read Data From a URL - FetchData.class 1. Create an object for FetchData class, pass the URL as argument. Don't forget to import the class. ``` -FetchData fetchData = new FetchData("https://projects.vishnusivadas.com/AdvancedHttpURLConnection/readTest.php"); +String URL = "https://projects.vishnusivadas.com/AdvancedHttpURLConnection/readTest.php"; +FetchData fetchData = new FetchData(URL); ``` 2. Start the fetching data. ``` @@ -54,7 +55,8 @@ String data = fetchData.getResult(); 3. Create an object for PutData class, pass the URL as argument. Don't forget to import the class. ``` -PutData putData = new PutData("https://projects.vishnusivadas.com/AdvancedHttpURLConnection/putDataTest.php", "POST", param, data); +String URL = "https://projects.vishnusivadas.com/AdvancedHttpURLConnection/putDataTest.php"; +PutData putData = new PutData(URL, "POST", param, data); ``` 4. Start the putData process. From b1ae1ba7cc9d4529383171318849a5ce8e70c9b2 Mon Sep 17 00:00:00 2001 From: Vishnu Sivadas Date: Tue, 23 Jun 2020 22:09:15 +0530 Subject: [PATCH 3/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 78a3c66..4b47752 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ String data = fetchData.getResult(); data[0] = "data-1"; data[1] = "data-2"; ``` - _Add as many as data and parameters as you like. Make sure number of parameters is equal to number of data. Also add then in exact order._ + _Add as many as data and parameters as you like. Make sure number of parameters is equal to number of data. Also add them in exact order._ 3. Create an object for PutData class, pass the URL as argument. Don't forget to import the class. ``` From 9499d0cf23b118d53295fa31fe84506d27f85a82 Mon Sep 17 00:00:00 2001 From: Vishnu Sivadas Date: Tue, 23 Jun 2020 22:11:56 +0530 Subject: [PATCH 4/4] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 4b47752..8f4d336 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ allprojects { } ``` ## Methods and how to use them +We have Two classes FetchData and PutData. Import the Library to your file first (In android studio paste the code and press alt + enter). ### Read Data From a URL - FetchData.class 1. Create an object for FetchData class, pass the URL as argument. Don't forget to import the class. ```