Permissions in Android 6.0 API Level 23

One of the important change that was introduced in Android 6.0 (API level 23) is the users grant permissions to apps. With this change all the device that is running Android 6.0 and above will have to request the permissions while the app is running, not when they install the app.

This approach will help the users to decide which permissions are necessary for an app and to decide weather to give that permission or not. Now its all depends on the users hand. It also gives the user more control over the app’s functionality.

for example, a user could choose to give a camera app access to the camera but not to the device location. The user can revoke the permissions at any time, by going to the app’s Settings screen.

System permissions are divided into two sections, normal and dangerous:

  • Normal permissions do not directly risk the user’s privacy. If your app lists a normal permission in its manifest, the system grants the permission automatically.
  • Dangerous permissions can give the app access to the user’s confidential data. If your app lists a normal permission in its manifest, the system grants the permission automatically. If you list a dangerous permission, the user has to explicitly give approval to your app.

Below you can find the list of Normal and Dangerous permissions list.

Normal permissions

Dangerous permissions


For more information. Please check out this link.

Android Loading images to Recycler View

In this tutorial i will give you instructions of loading images in a recycler view using Picasso library. One you complete this tutorial your application will look like this.

This application will list image of the android versions and its version names. OK. lets get started.

1. Create a new project.

Open up your android studio and create a new project with the name Recyclerimage. Note you can give any name you like, but for this tutorial i suggest using the same name.

2.  Create a layout for the recycler view.

Inside your res/layout/ folder create a new file called row_layout.xml . This file will have a simple image view and a text view and copy and paste the below code.

Then add a recycler view to your activity_main.xml as shown in below code. Make sure to change your tools:contex property according to your project package name.

3. Add permissions to Android manifest.

This application need internet connection to download images from URL, therefore it is necessary to add request the internet permission through your AndroidManifest.xml file as shown in the below code.

4. Creating data adapter.

Now create a new java class called inside your package and then copy and paste the below code.

Make sure to change the package name according to your project.

Now create another class inside your package and name it as and then copy and paste the blow code.

Make sure to change the package name.

Now lets modify the class to get the list of images and strings to add it in to the recycler view.

5. Modify compile dependencies in your Build.gradle file.

That’s it. Save the project and run it on your device or emulator. It should work fine. If you have any comments or queries leave it in the comments section below.  Thank you. Happy coding 🙂

Android Https Post and Get

Yesterday, i have done an piratical test for an interview. The task provided is to post a username and password to an https url and also to  get the response results using an https connection in another url. I have successfully completed the task, but it took me around five hours. I wasted lot of time in researching on how to do an https post. Therefore i thought i could share some of the important information, so that it will we helpful for some one. please not i am not going to share the entire solution.

First create an custom socket factory inside your package. Use the below code.

Add this function inside your MainActivity class to create a httpClient using custom socket factory. As shown in the below code.

Then Run an Async task for https post like this.

And if you want to do an https Get request. See the code below

Hope this helps. Feel free to ask any question if you have in the comments section below.Tnx, Happy coding 🙂

Installing Google chrome in Ubuntu 16.04

In this tutorial lets look on how to install Google chrome in Ubuntu 16.04.

Lets get started.

1) First do an update and install Wget. Use the below command to update Ubuntu packages and install Wget

2) Download the current stable version package using wget.

3) Force installing dependencies and install package

4) Now you have successfully installed google chrome, but you will not see it unless you restart your machine. use the below command to restart your machine.

That’s it.

Ubuntu 16.04 – Move the side bar to bottom

As we all know one of the new feature announced in Ubuntu 16.04 is moving your sidebar or launcher position. In this article i will share the command that will help you to move your launcher position to bottom.

Just use the below command to move your launcher to bottom of the screen.

And if you want to move the launcher to its original position to its original position (left) use the below command.

Hope this helps. Thank you. 🙂

List of countries in the world – Raw Data

I am developing an android application. In which i must ask the users to select their country, Therefore i searched on the internet for list of countries. I got lot of results, but i cant use those data in my application directly, with out making some modifications. Its just waste of time.

Here i am sharing the raw data which i have modified and used it in my applications. Hope this will we helpful for someone, while coding.

Thank you. Happy coding. 🙂

Loading images from server in to Android Grid view

In this tutorial, we will be looking at how to load images from server in to android grid view. Once you complete this tutorial, your application will look like this.


Lets call this application as a Movie Database. This will display list of movies and the name in a grid view.


1 . Creating Database

First of all lets create a database content_db. Create a new file named content_db.sql and copy and paste the below code and save it.

Now import the this file in to the database you have created.

2. Creating an API

Now you have the database ready, lets create an API to get all movies using PHP.

Copy the below code and save it in to file named content_db_getAllMovies.php in localhost location ( in my case its /var/www/html/). you can save it in your localhost location.

Make sure to change your database configuration as  per your database credentials, In the above file.

3. Creating an Android application

Now lets create a new android application called MovieDatabase, when you create an new application  in android studio it  will automatically create a new activity called MainActivity. You can  change it to anything you want, but i recommend to leave it as it is for this tutorial.

4. Creating Styles and Drawable

Copy and paste the below code inside /res/values/colors.xml file.

save and close it.

Now create a new file called grid_color_selector.xml inside /res/drawable/ folder and then copy and paste the below code.

save and close it.

5. Creating Layout files

Now create a new file called grid_item_layout.xml in your /res/layout/ folder and copy and paste the below code.

save and close it.

Now open your activity_main.xml which is located in /res/layout/  folder. open the file and copy and paste the below code.

Save and close it.

6. Java classes

create a new java file named inside your package and copy and paste the below code. make sure to change your package name.

save and close it.

Now create another new file called inside your package and then copy and paste the below code.

save and close it.

Now open you class and make sure it looks like the below code.

save and close it.

7. Create a second activity

Now we need to create a new activity to be viewed when ever the movie is clicked. So lets create a new activity called DetailsActivity using your android studio.

8. Modify Manifest file.

This application need a internet connection to get data from the server, therefore it is necessary to add that permission to the manifest file. As shown in the below code.

9. Gradle Build

It is important to tell the gradle how to build the application. Note this application is using HttpClient package which is no more supported in android studio. Therefore its is very important how you set the build.gradle file.

Make sure your build.gradle file looks exactly as shown in the below code snippet.

make sure to set your applicationId. That’s it. compile the application and run it on your device or emulator. It should work fine.

10. Happy coding.

Feel free to tell me your comments and feedback’s below in the comments section. Thank you. 🙂

Sample application form for US diversity visa program

I have tried the us diversity program for the past three years, but i have not found lucky enough. In this article i will give you some information and screenshots of the US diversity program.

Usually the us diversity program opens for application in the period of October and November. Usually they accept application for around 30 days.

sample application form

Screenshot from 2015-10-17 10_38_41


Screenshot from 2015-10-17 10_43_57

Screenshot from 2015-10-17 10_48_04

Screenshot from 2015-10-17 10_48_24

Screenshot from 2015-10-17 10_48_32

Screenshot from 2015-10-17 10_49_01

Screenshot from 2015-10-17 10_49_12

Screenshot from 2015-10-17 10_49_24

Screenshot from 2015-10-17 10_49_29

Screenshot from 2015-10-17 10_58_02

Screenshot from 2015-10-17 10_58_53

Screenshot from 2015-10-17 10_59_11



Good Luck!

mysql get the existing table code

I had a situation where i have a table with huge lot of fields. i want to recreate this table with some other name. It would be very easy if i have any user interface like php myadmin or mysql work bench but since i am working on the server there is no UI. Therefore i was looking on the internet for a way to get the sql code for existing table, so that i can just recreate the table by just running a single command.

then i found this on My Sql Developer page

Here is the results

Screenshot from 2016-05-16 14-43-25

Now i just need to copy the existing code and change the name of the table to the name i want and then run the script. thats it.


PDO database insert script – PHP

PDO_MySQL, is the MySQL for PDO. PDO has been introduced in PHP, and the project aims to make a common API for all the databases access, so in theory you should be able to migrate between RDMS without changing any code (if you don’t use specific RDBM function in your queries), also object-oriented.

The PHP Data Objects (PDO) extension defines a lightweight, consistent interface for accessing databases in PHP. Each database driver that implements the PDO interface can expose database-specific features as regular extension functions. Note that you cannot perform any database functions using the PDO extension by itself; you must use a database-specific PDO driver to access a database server.


Here is the sample PDO script to insert data in to the database. This script will take the input from post method and insert that in to the database. Using this script to insert values in to the database is very simple. Just download the below code and modify the fields as per your requirements. Also make sure to add your database credentials as well.

Here is the database table


Good Luck!