Do you want to learn how to upload/download/update/delete images and text stored in mysql database? D you want to learn how to create a full android mysql retrofit application? Do you want to learn Retrofit Multipart Upload in the context of a full application? Well then this is the project for you.
The project is written in Java and utilizes Retrofit 2, the most popular third-party HTTP Client. Data will be stored in a server online or localhost. That data include both images and text. We upload them at a go via single HTTP request thus making the operation not only efficient but less likely to fail.
The images will actually be stored in a folder the server. Then the image paths alongside other properties are stored in MySQL. When we retrieve data via a HTTP GET or HTTP POST request we fetch the data text stored in the database. The images are then efficiently loaded using Picasso asynchronously and rendered alongside texts in our recyclerview.
We will provide two ways of updating data. First users can update both image and text in a single asynchronous call. With this the image is replaced in the server and the new image path is saved in the database. This method will automatically be used when user selects a new image using imagepicker.
However if user changes only text and doesn’t change the images, then instead of making a multipart request we will just make an ordinary request and update only text without the image. This makes our update efficient as there is no reason to re-upload the same image twice just because the user has changed the text.
You will also learn how to delete data from mysql database as well as images from our server using Retrofit. We will do both in a single request. First we delete the image from the server then it’s path as well as the whole row the user has requested to be deleted.
Deleting is simple as we only need to send the row id to be deleted.
You will also learn how to fetch data from MySQL database via Retrofit. We provide two methods for fetching. One using a HTTP GET request. This method when invoked will fetch everything in a single call.
Then the second using a HTTP POST request. This will allow us to fetch paginated data. By default in the app we use the second method to fetch paginated data as the user scrolls.
(e). Offline First
Data is also cached on the device locally using LRU disk caching library. Thus even without internet connectivity and even after restarting the device, users can still view the data. This makes the app faster, efficient and bandwith friendly.
(f). Capture From Camera,Gallery,File Picker
This app implements for you the ability to capture images directly from camera. You can also pick already captured images from gallery. Moreover you can even pick images from the file explorer using directly from our upload page. You are asked to choose which method to use using a bottom sheet dialog. Runtime Permissions are implemented for you already.
The app will contain several screens:
We have two projects: Kotlin and Java, included in the downloads. The first app is completely written in Kotlin, then re-written in Java. Both apps are similar in functionality and features.
We achieve offline first approach by caching data to disk. This allows users to view data even when completely offline and even after device restart. We cache data on disk using reservoir library that implements Least Recently Used(LRU) caching. You can specify the size of cache.
The application uses custom fonts using Calligraphy library. You can use any font you like. You just download the font from online, then add it in the assets folder, then specify the font in the App class and that's it.
The application uses CarouselView to create an image slider with beautiful animations. The images can autoslide or be swiped. The images shown are those that have been downloaded alongside the data from our MySQL database.
The application includes the ability to paginate data. Only a limited amount of data is downloaded for every request. You can change the figure. Then as the user scrolls through the recyclerview the next page is downloaded using Load More technique. When there is no more data the user is notified.
The application includes a client side search filder capability. Users can rapidly search through the already downloaded data via SearchView. As the user searches the results are highlighted in our recyclerview.
We have beautiful dialogs to be used for showing info or warning to user or for choosing items. We make use of LovelyDialogs library.
In case of any problem, we are available to provide you with full support. Just contact us via the Contacts Form or through my email: firstname.lastname@example.org.
Camposha is a website dedicated to bringing you high quality tutorials, projects and libraries to aid your programming skills development and help you learn faster.