Skip to main content

Posts

Number Picker - Android Tutorial

Here we are going to see how to use NumberPicker. NumberPicker is a  widget that enables the user to select a number from a predefined range. We can see the NumberPicker in Old Style of TimePicker How it works -         You can select the values on scroll up or down        You can also edit the value that on view Lets see an Example to implement (E.g. for Select the date) Create and XML <LinearLayout     android:id="@+id/id_picker_ll"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:orientation="horizontal"     android:weightSum="3">     <NumberPicker         android:id="@+id/year_pick"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:layout_margi...

Spinner with Search on DropDown - Android Tutorial

If you have more values on Dropdown of Spinner its hard to select the last item by making a long scroll. To overcome this issue Android introduced a component called  AutoCompleteTextView Yes it is!!! Then why Spinner with Search? There may be some requirement even though gave much knowledge about it. There is a simple and good library that helps us to achieve this -  SearchableSpinner Gradle dependencies {     ...     implementation 'com.toptoche.searchablespinner:searchablespinnerlibrary:1.3.1' } Usage Now replace your Normal Android Spinner on XML with the following < com.toptoche.searchablespinnerlibrary.SearchableSpinner     android:id="@+id/id_city"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:background="@android:color/transparent"     android:padding="5dp" /> ______________________________________...

Set Focus on Spinner when select Item on Vertical Scroll - Android Tutorial

We may face an issue on Spinner lies on long vertical scroll, (i.e.) when selected and item from dropdown the focus moves to top of scroll. To avoid this please follow this piece of code spinner.setFocusableInTouchMode( true ); spinner.setOnFocusChangeListener( new View.OnFocusChangeListener() {     @Override     public void onFocusChange(View v, boolean hasFocus) {         if (hasFocus) {             if (spinner.getWindowToken() != null ) {                 spinner.performClick();             }         }     } });   _______________________________________________________________________________ Happy Coding...

Integrating Crashlytics to monitor your Android app’s health

Crash monitoring tools help developers build, deploy, and maintain high-quality apps. These tools can alert you to new issues in real-time. The quicker you learn about new issues, the sooner you can get a fix to your users. There is also an opportunity to proactively reach out to users impacted by ongoing issues. All developers should implement some form of crash reporting to monitor the health of their apps. This article will guide you through quickly setting up crash monitoring with Crashlytics in your current Android app. There are many alternative tools you can use for crash monitoring, but Crashlytics–a Fabric service owned by Google–is one of the most popular and widely used. Crashlytics’ integration is easy–even for novice developers. It is completely free. The reporting is customizable and detailed. There’s good documentation and support. While other crash reporting tools may be more suitable for your needs, it’s important note that some tools like Firebase require Goog...

Multi language support

This post will help you yo learn how to make Multi language supported app in android. Why Multi language? In order to targeting global audience, it will be beneficial if you make your app localized. While localizing, you should think about text, audio, currency, numbers and graphics depending upon the region or country. But in this tutorial language only covered. Note: Whenever you are making any android application, Always declare text you want to use in your application in strings.xml only. <string name="hello">Hello World!</string> How String Localization Works? By default android considers English as primary language and loads the string resources from res >> values >> strings.xml . When you want to make Multilanguage supported app, you need to create a values folder by appending a Hyphen (-) and the ISO language code. For example for Hindi, values-hi named folder should be created and keep a strings.xml file in it wit...

Set custom marker on Google Map

This exercise will help to set custom marker instead of default marker.🚩 Something like in the screenshot below To set an custom marker you can use the previous exercise -  Draw Polyline on GoogleMap of Google Maps Android API v2 And make an edit on set marker on it. Place where the marker is set MarkerOptions markerOptions = new MarkerOptions();         markerOptions.position(latLng);         markerOptions.icon(BitmapDescriptorFactory.fromBitmap(getMarkerBitmapFromView(R.drawable.pulis, context))); Custom Marker function[getMarkerBitmapFromView(int,context)] public static Bitmap getMarkerBitmapFromView(@DrawableRes int resId, Context context, int check) {         View customMarkerView = ((LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.view_custom_marker, null);         CircleImageView markerImageView = customMarkerView.findViewById(R.i...

Draw Polyline on GoogleMap of Google Maps Android API v2

This exercise will help to draw a line on Google map between two or more co - ordinates. Like in an Screenshot below. Let's see how to do this: Important- Generate SHA1 certificate for your Google map from google developer account from below link- https://code.google.com/apis/ Add the dependency: implementation 'com.google.android.gms:play-services:8.3.0' 1. activity_main.xml <fragment         android:id="@+id/map"         android:layout_width="fill_parent"         android:layout_height="fill_parent"         android:name="com.google.android.gms.maps.SupportMapFragment" /> 2. MainAction.java public class MainAction extends AppCompatActivity         implements OnMapReadyCallback,         GoogleApiClient.ConnectionCallbacks,         GoogleApiClient.OnConnectionFailedListener,         Locatio...