SharedPreferences are one of the easiest ways to store data locally as it requires very minimal overhead. However, there were certain restrictions or issues with SharedPreferences that should get rectified because of the advancement of the programming language from Java to Kotlin.
What were the issues with SharedPreferences?
All the above issues are now rectified with Preferences DataStore which under the hood uses kotlin flow and coroutines, that’s the reason now you can call save operation from the main thread and it will automatically switch the call to background thread by changing the context to IO thread. …
As constraint layout 2.0 is available in the stable version so with that we also have motion layout in the stable channel because motion layout is the sub-class of constraint layout. With motion layout, you can create complex animation with ease as it hardly requires manual coding to create animations.
How does it work?
Motion layout is a sub-class of constraint layout which means all those concepts of constraint layout like positioning the views etc are applicable with motion layout also, apart from that you will also create another XML where you can define when your animation should start, the path for it and even change the constraint, properties or attribute from the motion scene file defined in XML. …
Constraint layout have an ability to create a complex layout without increase hierarchy but there were certain scenarios where just having a flat layout makes development further complex. Those problems are sorted out in constraint layout 2.0 and it also offers complex animation using the motion layout.
It’s a virtual layout which offers all capabilities that linear layout can offer while using flow you can create views without specifying individual view constraint because it requires all those views to be referenced to flow and just assign constraint to flow is sufficient.
Why flow is called as the layout is because it offers capabilities like layout where you can set padding, background, align to other view and best of all is that you get all those without adding a viewgroup, as viewgroup is not added that means any individual view referenced in flow can also be referenced directly instead of referencing only flow. …
Kotlin is certainly a beautiful language and for developers having such a language enhances productivity and reduces the development time and effort. The best thing about kotlin is the active development in the ecosystem where new feature gets added as the new version gets released and those new features even enhance the productivity of developers.
With Kotlin 1.4 we have some handy language features which are helpful to write a concise and effective program.
A single abstract method is a great way to reduce interface callback with lambda provided you have a single method in the interface. …
Machine learning model could be huge in size and adding the tflite model to android or iOS app while packaging it to apk to ipa file will increase the size of the app, however with an increase in the size of the app the amount of installation may come down, so one of the ways to reduce the size of an app can be deploying the model and downloading it on the fly based on the requirement.
Firebase Machine Learning Custom Model
Firebase machine learning is one of the services by firebase which offers ML capabilities where you can either deploy the custom trained tflite model or even train the image classification model using AutoML Vision Edge.
The model can be deployed from firebase console or through the script in the case of a script as soon as you have trained your machine learning model and converted to tflite it would then be deployed on firebase right from that same python script. …
Machine learning is really important to unlock those features which were quite difficult to achieve before introduction to machine learning however the amount of expertise it requires is a matter of concern for many. So how about getting the ability to add machine learning capabilities to either android or iOS apps without having much experience in training the model or deploying them.
Firebase Machine Learning
The platform which provides solutions to many problems now has a dedicated service for cloud-based machine learning, it’s firebase. Earlier firebase had a service called ML Kit which offered on-device and on-cloud machine learning capabilities to the mobile app but now it got its own standalone SDK for all on-device machine learning and on-cloud remains on firebase platform with the service named firebase machine learning. …
Kotlin is certainly a beautiful language that most of the android developers love and there could be multiple instances when kotlin features would have saved time for app development and improved the quality of it. Firebase APIs are concise and specific to what they do however kotlin can improve it further by making it developer-friendly and even concise than what it is currently.
ktx extensions got started with a set of libraries for Android and now those are getting extended to the firebase also. Firebase kotlin extensions provide a kotlin way of calling APIs that looks much neater and cleaner than before. …
Tensorflow serving is a mechanism to host the trained model on the server so that inference can be done without downloading model on the local system. A machine learning model is a mathematical function that takes some input and delivers the result, the result is nothing but the prediction(inference) which is based on features provided to it as the input.
Before we begin with the hosting model let’s see the type of machine learning.
Types of machine learning?
There are broadly 3 types of machine learning
1. Supervised learning
2. Unsupervised learning
3. Reinforcement learning
It’s a type of machine learning wherein the input and output which is already known, in ML term input is nothing but the features and output is the label. The two categories of this type of ML is Classification and Regression.
In the case of classification, the output is a definite value like true or false (0 or 1) whereas in regression the output is a continuous value like the price of a stock after a certain time. …
It’s a modern toolkit by Google for building a native android app that simplifies and accelerator UI development and brings more flexibility while developing and designing the android app. The structure which it follows is similar to declarative programming where composition takes preference over the inheritance.
All the UI components are written inside the function marked as @Composable this function is the same as any other function where the annotation used here is just to make compiler understand that this function contains the code to build UI. A different kotlin compiler is bundled with android studio 4.0 …
Machine learning is certainly the hot buzz word where everyone wants to get the advantages of it but great things comes with great cost and so as machine learning. Gathering dataset, training, testing all these requires a great amount of effort in order to get a good model. How about if all these can be done automatically where you just have bring your data and rest of all gets automated to give a well trained model.
Firebase this year added another machine learning capability to ML Kit which is AutoML Vision Edge, this provides the image labeling capability to Android and iOS app where you can train the model by providing the images for example a model can be trained to distinguish between the name of dishes, identify the type of object like cricket bat, baseball etc, the model is trained on firebase and provides three options for the model that is either download it, publish on firebase or download and publish in order to use it in the app. …