Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
VishnuSivadasVS committed Jun 24, 2020
2 parents 57cc208 + 9499d0c commit 57a7548
Showing 1 changed file with 38 additions and 2 deletions.
40 changes: 38 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,53 @@ 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.
```
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.
```
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 them in exact order._

3. Create an object for PutData class, pass the URL as argument. Don't forget to import the class.
```
String URL = "https://projects.vishnusivadas.com/AdvancedHttpURLConnection/putDataTest.php";
PutData putData = new PutData(URL, "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.
Expand Down

0 comments on commit 57a7548

Please sign in to comment.