Posts

Android parse JSON Key dynamically

Image
  JavaScript Object Notation   JSON stands for JavaScript Object Notation. It is an independent data exchange format and is the best alternative for XML. As a refresher, there are four main components of a JSON file: JSON array, JSON object, Key, and Value. Usually, we need to get the value of the specified key. But the key is sometimes vital, and you need to get it like some Currency Exchange APIs. In this article, we will know how to parse a key dynamically by tackling two examples. First, Parse the JSON key with the value: In the first example, we need to get the currency code which are the keys.   Parse the JSON key with the value In the above image, the currency codes are inside the red box and the double values beside them are their rates. So, to create our model class for it, you will define a Map of String as a key and double as a value representing currency codes and their rates. @SerializedName( "rates" ) val rates: Map<String, Double>,...

Support multiple themes in an Android app

Image
  Do you get bored with one color app? Do you want to build an app with more than two colors mode? If Yes, so you come to the right place. Multi theme app makes your users love your app most as they may not like your chosen default color, so you give them a chance to use your app with their favorite color. It is a powerful feature. Let’s know how to apply it. 1- Create Custom Color Palette to make User choose a color from: Create your color_palette.xml layout <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android= "http://schemas.android.com/apk/res/android" android:layout_width= "wrap_content" android:layout_height= "wrap_content" android:orientation= "vertical" > <LinearLayout android:layout_width= "match_parent" android:layout_height= "wrap_content" android:orientation= "horizontal" > <TextView...

Resize images to support Android devices

Image
  To help Android developers resize their images to support different Android devices, I have created JavaFX application to resize images in only one easy click without changing their quality, and add them into folders automatically. It is a powerful Cross-Platform tool for Android developers. Moreover, Any other developers can use it to resize images with their favorite custom size. With  Fast Image Resizer , you can: Select the resource directory, so you don’t have to move the resized files. Resize several images at once (Drag & Drop) Select output densities (ldpi, mdpi, tvdpi, hdpi, xhdpi, xxhdpi, xxxhdpi). Make a custom size using width and height. Preserve the image format (jpg, jpeg, png, bmp, gif). Select output directory (drawable or mipmap). Delete the selected image or images. Press to display the chosen image. Show images' informational details (type - size - dimensions). Enjoy resizing images and Happy Coding! Get it through SourceForge or Fast Ima...

Build an E-commerce Store App like Souq.com for Android

Image
  Many developers want to know how to create an e-commerce store app, and so am I. Therefore, I have decided to build an E-commerce Store app that looks like souq.com . When I shared it, so many developers liked it and asked me about it, so I decided to write about it and give you an idea about its features. My app is implemented using MVVM Architecture . I have written the Back-end rest API in MySQL and Node.js . It is a clone of Souq.com , but it is not identical. As you know, to build an app like Souq.com , you need to have a big team to collaborate. However, I have made this app myself, and it includes lots of features that you can implement in your app. First of all, the user can sign up for getting a new account if he/she does not have one, or log in to their existing accounts. The app enables them to add other products if they have admin accounts. They can browse products and see details about them like product name, picture, image, price, etc. Besides, the user...

Hide and Keep your API key out of GitHub repository

Image
  Secure your API key     When you upload your Android app on GitHub, you need to hide it as no one has access to it except   you. It is considered a security glitch, so that’s why it is important to hide your API key. I am going to show you how you can do that easily. Some Developers store their API key in a String variable like this. private static final String APK_KEY = "asjsdakf4d3ggs2ytm4x";   It is not good to push your secret th i ngs into public repository as other people could use up your limited API calls. That’s probably the least concerning situation. Sharing of API keys becomes more of a concern if the API key authenticates someone for access to a subset of data. So, let’s see how we can do that.   1. Create a file called gradle.properties in .gradle folder. - Drive C - Users folder - your user folder - .gradle folder Create it here - gradle.properties     Then, write your APPNAME_API_KEY = "asjsdakf4d3gg...