This is a sample app that demonstrates REST API. I have used Retrofit library. I have used Picasso library to load images. There are 3 values in the table.
- Roll Number
- Name
- Image
So basically we have a UI / Activity with 5 buttons. Each Button represents 5 commonly used HTTP requests.
- Read (GET Request)
- Write (POST Request)
- Update (PUT Request)
- Patch (PATCH Request)
- Delete (DELETE Request)
When user clicks on the button he/she would be taken to respective activity. Now below you can see screenshot of each activity.
Main UI/Activity
Read UI/Activity Here the user can see all the data as a list of items.
Write Activity Here the user enter all the values and uploads an image and does POST Request. If successful he/she can see the image uploaded and the values entered as shown below.
Update UI/Activity Here the user enters old roll number (used to get old details) and then he/she enter new details and creates a PUT Request. If successful he/she can see the updated values in response. Its actually "New Name". OOPs I had changed the name before updating. That is why the name is shown as New Name instead of New Value in response.
Patch UI/Activity Here the user enter old roll number and has option to change either Roll number or Name. Here we have chosen roll number and entered the new roll number. After that we get a response.
Delete UI/Activity Here the user enters the name to identify row which has to be deleted. If found, he/she can see message "ok" as shown below.