Hi, Oclemy here. Talk to me: firstname.lastname@example.org
Kotlin Retrofit MySQL Multipart Images CRUD – UPLOAD DOWNLOAD UPDATE DELETE Full(Java also included)
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.
There are two projects included one written in Kotlin and another in Java. We utilize 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 or captures image directly from the camera.
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.
(d). FETCHING with Pagination
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(Least Recently Used) 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. You can specify the cache size. If your size is exceeded, data is purged based on the LRU concept. The Least Recently Used ones get purged first.
(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:
- Upload Activity – Activity used for uploading our data, both images and text. This same activity will also be used for updating existing data as well as deleting data. It’s probably the most important activity in the project.
- Listing Activity – This is our recycerview activity. It is used for rendering data. Both images and text are rendered nicley in a cardviews. At the top we have a carousel which slides through the fetched images automatically.
- Detail Activity – This, as the name suggests will render the details of a single Star object. We use CollapsingToolbarLayout with NestedScrollView containing a CardView with our details. There is also a menu item as well as a Floating Action Button that when clicked takes us to the Upload Activity for editing/deleting the selected Star object.
- Splash Activity – Just good old splash screen. Optional in this type of app.
- Dashboard Activity – This like the menu activity or the home activity. From it you can navigate to other parts of the application.
- About Us Activity – You can use this to show your contacts info etc.
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: email@example.com.
First thanks very much for purchasing this project. Am available to assist you all through the way.
RUNNING THE PROJECT
1. Extract the project.
2. In you android studio import the etracted project
3. Then sync to download dependencies.
When you run the project, we will use a demo mysql database we host online.
SETTING UP YOUR DATABASE
1. In XAMPP/WAMP server root directory create a folder named PHP.
2. Inside this PHP extract the stars.zip file.
3. In the code go and comment this line:
R::setup( ‘mysql:host=localhost;dbname=camposha_demos_db’, ‘demo’, ‘9AmaFn6jpmNe8DN6’ );
The above line is the user credentials for our online mysql database. We comment it if we want to use
Uncomment the following line:
R::setup( ‘mysql:host=localhost;dbname=camposha_demos_db’, ‘root’, ” );
In the above line we are using the default root superuser.
4. That’s it.
You don’t have to create a database. We are using Redbean PHP which will automatically create for us
a database and a table based the data we are trying to save. However you have to attempt to save data
first. For example go to the CRUD page of the app then choose an image, fill all the fields and click
upload. ReadbeanPHP will create a database table based on those fields.
For queries contact me: firstname.lastname@example.org
HOW TO OBTAIN YOUR IP ADDRESS
- Connect to a wifi network.
- Type ipconfig in the cmd
- The IPv4 Addess will be listed. It is your ip address
Look at the image below:
Demo and APK
You need to know what you are buying, don’t you? Well here is the APK demo. Just install it and run. We have a hosted online database to use for demo purposes.
We have written a public article associated with this project. READ IT HERE.
It’s not that if you buy the project then game over, no, you will continue receiving updates for free. We are always updating our code and adding more features and improving code quality and fixing bugs.
Here are the updates:
March 3rd 2020(Major Update)
- Added offline capability through LRU Disk caching support. Data is stored offline as well.
- Redesigned Details Page completely and updated font sizes.
- Added RobotoBold font and used it as default.
February 25th 2020
- Added ability to dismiss the welcome card in dashboard page.
- Added Data Binding support to ListingsActivity as well.
February 10 2020(Major Update)
- Added ability to capture images directly from camera, pick from file manager as well as gallery.
- Added Runtime Permissions support.
- Added complete Data Binding support.
- Added ClearText communication support – ability to communicate over insecure http.
- Fixed problem where already typed texts in edittext were clear after picking an image.
- Updated pagination parameters.
- Reduced the quantity of code needed to upload/update/delete/download by re-using a single RetrofitBody object.
- Added memory caching support to prevent re-downloading data everytime a user navigates to the listings screen.
- Updated model.xml layout.
December 8 2019
- Fixed server side delete code returning null.
November 29 2019
- Published the project
We provide lifetime support exclusively by email address. I always reply as soon as I receive the email. However this will be within a 24 hour window.
My email address: email@example.com
Let’s address some of the questions you may have. Remember you can ask us any question, even those not related to this project via my email address: firstname.lastname@example.org.
Why do you Charge for Projects, why don’t you just offer them for Free?
Well we have more than 5oo free mini-projects and tutorials, and almost 1000 free coding videos in YouTube.
However alot of students kept asking us to make full projects. We looked online and saw that indeed it was difficult to find full, easy to understand, supported and high quality projects geared towards students. So we decided to fill this void. However it takes alot of time and effort so we charge for sustainablity. We also provide lifetime support and updates to our projects. Thankfully, we are getting good feedback of this decision.
What if I buy the Project and it doesn’t work?
Well we thoroughly test our projects across many devices and only publish them once we are sure they work. However if there is a problem, probably in some devices you can contact us and we will provide a fix. However we only provide fixes related to the project and not general or apps you have created. We can do that but in a separate plan.
Can You Help me customize this Project and add more features?
Yeah. However again this is a different plan. Feel free to email us the features you want and we will talk.
Will You be sending me Updates?
Yeah. We will be sending updates to your email address. We provide lifetime updates.
Do Projects help me learn Faster?
Absolutely. People learn coding by coding. Reading is good but it’s slow and you won’t get far just by reading. Projects force you to work with several concepts even if you may not understand them in detail at first. Getting a project designed for students will ease you in. Try this, read a book or articles for one month and document what you can do, then get a good project and attempt to customize it for one month, then compare the improvements you made between those two months.