Skip to main content

Posts

Showing posts from September, 2017

Android Context Menu

Context menu is  a floating menu  which appears when user press long-click on an element.

Java read data from file into array of classes

We are often required to read a text file and store it's data into array of  a class.  Let's take an example where we have a text file movie.txt  containing movie name, release date, production cost and profit.

Android Menu

We will implement Options Menu which contains options like add new, close , settings on the action bar.

Android Custom Dialog Example

We will create a custom dialog box with EditText and Button and pass the result to main activity. 1.  Create a new project in android studio.

Android Recycler view

RecyclerView is like ListView and GridView which is used to represent collection of items. RecyclerView is recommended when the app needs to display large amount of data or data that change frequently. RecyclerView helps to implement a user interface that runs efficiently. Let's take an example to show a list of names using recyclerView. 1. Create a new project. 2. Open app-level build.gradle and add the following dependency- dependencies {         compile 'com.android.support:recyclerview-v7:25.0.+'     } 3. Open activity_main.xml and add RecyclerView. <? xml version = "1.0" encoding = "utf-8" ?> <LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android"     xmlns:tools = "http://schemas.android.com/tools"     android:id = "@+id/activity_main"     android:layout_width = "match_parent"     android:layout_height = "match_parent"     android:orientation = "ver...

Android Integrating Facebook Login

Users can sign up in your app using their Facebook account , that would make your app more user-friendly. Follow these steps to enable Facebook login- 

Android SQLite Database

Android allows us to store data in various ways. Refer this  Android Data Storage . If you want to store small amount of data then Shared Preferences can be used. SQLite Database is used to store related or unrelated data, takes small amount of disk space.

Android Integrating Google Sign-In

Now-a-days, most users prefer to sign up with Google rather than filling a registration form. Google sign-in integration makes your app user-friendly. Following are the steps to integrate google sign-in : 1. In android studio, open SDK  Manager and install Google Repository . 2. Create new project in android studio and copy the package name (will be used in next step). 3. To integrate google sign-in, google-services.json is needed. Infact, whenever we use any Google api we need this file. Go to Android quick start  and get a configuration file for your project.Enter the same package name as above. 4. Now, you have to provide SHA-1 fingerprint to use Google Sign-In. To generate SHA-1 , open command prompt and enter this command- keytool -list -v -keystore "C:\Users\%UserName%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android If it asks for password then enter android . Now, Paste SHA-1 and click on Enable Google Sign-In and then cli...