Skip to main content

Posts

Barcode Scanner in Android using zxing Library

Hi Everyone, Last week I tried to implement a barcode scanner using the zxing library. Writing this blog on this topic because I found the tutorials about barcode scanner using zxing is either pretty much older or confusing. Let's start by importing these two libraries in our Android project. compile 'com.journeyapps:zxing-android-embedded:3.0.2@aar' compile 'com.google.zxing:core:3.2.0' Practically , we only use the back camera for scanning the barcode because it has more clarity and auto-focus feature. But , I will also show how to implement the same with the front camera. Create a new layout and add two buttons for opening the barcode scanner with front camera and back camera. activity_main.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http
Recent posts

Customize Run Time Permission Dialog in Android

Hello. We all know how run time permissions came into effect from Android 6.0 ( Marshmallow ). The advantage is that it's more user friendly and it gives the user an idea about why he has to give such permissions for the app. Such as giving his contact details , his location details etc. But, even-though there is one flaw in it. Maybe exactly not a flaw, but we can't really customize that run-time permission dialog or it's contents. Android OS won't allow us to customize it's default settings in this case. So, the only option now remaining is to pop up a dialog just before the original run-time permission dialog. You can then describe to your user what exactly you are going to do by accessing such permissions. I have found many answers on StackOverflow and I combined those answers to my required one. What we are going to do today is asking the permission of user for accessing his location. Simply said, asking him to turn on his GPS. There is a method called che

Expandable ListView in Android on Complex Layout

Hello, Last day while at work I encountered an issue such as when I try to implement a expandable listview the override method "@getChildView" is not being called. When I looked around, I found out that the issue is mainly related to the expandable listview being inside a scrollview or any such complex layouts. I fixed the issue after searching through some answers on stack overflow, I have provided the links of the original answer at the end of the post Response will be of the format { "movie_details": [ { "name": "Fight Club", "type": "Movie", "id": 1 }, { "name": "13 reasons why", "type": "Series", "id": 2 }, { "name": "Dunkirk", "type": "Movie", "id": 3 }, { "name": "Game of thrones", &