Posts

Showing posts with the label 2019

Flutter: Getting Started

Image
  Introduction It has been over 6 months that Flutter 1.0 was released by Google and the Flutter Community is growing day by day. At the time of writing this article Flutter, 1.5 is available. Now, Flutter is pretty stable and is gaining attention from developers all around the world. Flutter is Google’s portable UI toolkit for building beautiful, natively-compiled applications for mobile, web, and desktop from a single codebase. You can check it out on the Flutter Official Website . So, if you haven’t yet started developing apps with Flutter, you should get on-board as soon as possible because it is better late than never. For the people who have very little knowledge about Flutter and what it is about, you have come to the right place. I will start for the very beginning. Many people who want to get started with Flutter app development have a big confusion that Flutter is a language. NO, Flutter is not a language as I have also stated before that ...

Android: Bottom Sheet

Image
Credit: material.io Bottom sheet is a component that slides up from bottom of the screen to reveal more content. You can find more detailed information of Bottom Sheet on Google Material Design guidelines.   Adding resources Add the latest appcompat and design support library to your project. dependencies { //replace X.X.X with the latest version compile 'com.android.support:appcompat-v7:X.X.X' compile 'com.android.support:design:X.X.X' }   Make your activity extend AppCompatActivity . public class ButtonActivity extends AppCompatActivity { ... } Creating layouts Bottom sheet content We’ll include the layouts for the sake of simplicity. This is the layout that will contain the content of the bottom sheet . File is bottom_sheet.xml . <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas....

Android Detect Internet Connection Status [UPDATED]

Image
In android, by using ConnectivityManager class we can easily determine whether the network or internet connected or not and also we can determine the type of internet connection currently available i.e. whether it’s mobile data or Wi-Fi. To get the internet connection status, our app must acquire the INERTNET and ACCESS_NETWORK_STATE permissions. For that, we need to add the following permissions in android manifest file like as shown below. < manifest >     .... < uses-permission android:name="android.permission.INTERNET" /> < uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />     .... </ manifest > Check Internet Connection Status In android, we can determine the internet connection status easily by using getActiveNetworkInfo() method of ConnectivityManager object. Following is the code snippet of using ConnectivityManager class to know whether internet connection ...

Android Working with SVG/Vector Drawables

Image
In this tutorial I will guide you on How to import Vector Assets and Drawables in your Android application. I will also cover how to give support for devices which do not support vector assets using AppCompat library. Importing Vector Asset using Android Studio In case of Vector Assets You do not directly copy paste your icons and images in drawable folder. There is tool in Android Studio for importing Vector Assest or Scalable Vector Graphics (SVG). Go to File => New => and select Vector Asset. Importing Vector Assets (SVG) Android Studio You can also enable RTL (Right to Left) support. When your application will be running in RTL mode, your SVG icon will be flipped automatically. After this step SVG file which you imported above will be converted into XML file. Vector Drawable XML Preview At this step we are ready to use above icon in our application but there is a lot more to do. Backward Compatibility for SVG Vector Drawables or Scalable Vector Graphi...

Smiley Rating Library For Android

Image
SmileyRating is a simple rating bar for android. It displays animated smileys as rating icon. Drawn completely using android canvas Inspired by Bill Labus Demo Integration Integrating SmileyRating in your project is very simple. Step 1: Add this dependency in your project's build.gradle file which is in your app folder compile ' com.github.sujithkanna:smileyrating:1.6.8 '   add this to your dependencies. Step 2: Now place the SmileyRating in your layout. Note: The height of the SmileyRating will be automatically adjusted according to the width of this component. < com .hsalf.smilerating.SmileRating android : id = " @+id/smile_rating " android : layout_width = " match_parent " android : layout_height = " wrap_content " /> Step 3: Initialize your view SmileRating smileRating = ( SmileRating ) findViewById( R . id . smile_rating); Set this SmileyS...

Android RecyclerView with Endless Scrolling

Image
In this tutorial, we’ll be discussing and implementing Endless Scrolling or Infinite Scroll on RecyclerView in our Android Application. The infinite scrolling in which the next set of rows are fetched from the DB/Server while showing a loading icon is commonly seen in many applications such as Facebook, Twitter. Android RecyclerView Load More In order to show Loading icon at the bottom of RecyclerView while the next set of items are fetched, we need to use Multiple View Types in our RecyclerView Adapter. How is this implemented? Typically in a simple RecyclerView, we load elements to the adapter from a Data Structure. In order to show the loading icon view at the bottom of the RecyclerView, we need to first add a NULL element to the end of the Data Structure. Why NULL? In order to differentiate that element from the rest of the elements and show a different view type row. After adding a null, we notify the adapter the of the new element and fetch the next set of elem...

Android Working with Bottom Navigation

Image
In Android, there are many options for making navigation easy in your application for the user. Bottom Navigation Bar is one of them. Bottom Navigation Bar always stays at the bottom of your application and provides navigation between the views of your application. So in this Bottom Navigation Android Android Bottom Navigation Below you can see a Bottom Navigation.  Bottom Navigation Android I guess many of you are already aware with this component, or you might have seen this thing in some applications. We use Bottom Navigation When we have at least 3 top level navigation views. Using Bottom Navigation in Android It is very easy, you can create a Bottom Navigation Activity in your project by following ways. 1. you just need to use <android.support.design.widget.BottomNavigationView /> , if you want to do it in XML. 2. Android Studio also have a predefined template for creating BottomNavigationView, when you create a new Activity you can select Bot...