Skip to main content

Posts

Android: Current Location Using Fused APi on Google Maps

This tutorial gives us the simple implementation of "Fused API" to fetch the current location on google map in android. Fused API is latest among all techniques to get the location. It provides you very precise results and also uses less battery of your device. It chooses GPS or Network provider to get to your current location. And it helps your device remember about the last saved location. Let's implement the Fused API to fetch/get the current location. Step 1: Create a new project in Android studio. and select Maps Activity.

Android: How to Generate Key Hash for Facebook Integration

Hello everyone, As this is a quite confusing for everyone to generate the key hash in your PC, so i decided to write about it. I have also tried many ways but every time i failed to generate the key hash. After trying for an hour i successfully generated the key. Just follow the below given Steps and you are done with this. Step I: Download Openssl from   here Step II: Download openssl-0.9.8e_X64.zip for 64 bit PC and openssl-0.9.8e_WIN32.zip for 32 bit PC Step III: once your download the zip folder. Go to C drive(where window is installed) and make a folder named openssl Step IV: extract all zip file in this folder. Step V: Now go to Java folder and copy path of jre. For example: C:\Program Files\Java\jre1.8.0_101\bin

Navigation Drawer sample source Code in Android Studio

activity_main.xml <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout     xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:id="@+id/drawer_layout"     android:layout_width="match_parent"     android:layout_height="match_parent"     tools:context="com.example.johnwick.navigation_drawer.MainActivity">     <FrameLayout         android:id="@+id/content_frame"         android:layout_width="match_parent"         android:layout_height="match_parent"/>     <ListView         android:id="@+id/left_drawer"         android:layout_width="240dp"         android:layout_height="match_parent"         android:layout_gravity="start"   ...

Android: How to Create a Single Activity !!

Well, this is the most necessary and initial part in android development. One should have knowledge about creating an Activity. It represents a single screen of your application, for more details check this Article on  Activity  and  Activity Life Cycle Every activity in android consist two files. One is JAVA file and another is XML fie. JAVA file helps you implement the functionality of components that you defined in your XML file. To create an layout you should have an XML file. This is the file where you create an user interface for your activity. There are two approaches to create an Activity: 1. Create both the files(JAVA & XML) separately and define it in Manifest file a) In android studio, Select File Tab and click New

Android: Login Screen using Fragments

In this tutorial, our focus is on making a User/Member login activity using fragments. With the help of Fragments we will use the same activity to show User login area and also Members Login area. Prerequisite for this tutorial: You should be know how to make an Activity And most importantly you should have prior Knowledge of Fragments. For practising basic Fragment implementation refer to Android Simple Fragment Example      We have used only three activities for this: MainActivity(which represents the Login Screen) Fragments for Members area Fragment for New Users

Android Activity Life Cycle

This is the most important and basic concept in Android. In Android, every activity has its on life cycle. An activity encountered the following methods in its life cycle. 1. onCreate() 2. onStart() 3. onResume() 4. onPause() 5. onStop() 6. onResume() 7. onDestroy()

Android : Activity

An Activity is an application component that provides a screen with which users can interact in order to do something, such as dial the phone, take a photo, send an email, or view a map. Each activity is given a window in which to draw its user interface. The window typically fills the screen, but may be smaller than the screen and float on top of other windows.[1] http://developer.android.com/guide/components/activities.html [1 ] An Activity is a screen in which user perform some task. It might be capturing image, dialing phone number, typing text message etc. These all are the activities. Almost every screen with which users interact is an activity.

Android: Create a PopUp Window Example

MainActivity.java package com.example.popupwindow; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class MainActivity extends Activity {    Button btn;

Android Simple Fragment Example

For creating a fragment we only use two things:- Fragment class Fragment xml layout In the below discussed example we need to show different fragments on button click event. So, we will be creating two layout files and two different classes. Here goes the code for first Fragment: FirstFragment.java package com.example.fragementdemo; import android.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; public class FirstFragment extends Fragment {

Android App Using External font face(Custom)

Create a new Project. Make a new folder named ‘Font’ into your assets folder Paste the font file into this folder Now add the below written lines into your Java file.        textview =(TextView)findViewById(R.id. text1 );        Typeface font = Typeface. createFromAsset (getAssets(), "font/Maximum.ttf" );        textview .setTypeface(font);

Simple Login/Register Example using SQLite database

MainActivity.java(login Screen) package com.AndroidDevelopmentGuru.database_new; import java.util.List; import android.app.Activity; import android.content.Intent; import android.database.Cursor; import android.os.Bundle; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends Activity {                                 EditText user, pass;                 Button login, not_reg;                 DatabaseHandler db;           ...

Divide Layouts into Two Parts Programmatically(without using xml)

For this we just need a class and we will programmatically create the Layouts. And after this we will add Buttons in each layout. package com.AndroidDevelopmentGuru.progmatic; import android.app.Activity; import android.graphics.Color; import android.os.Bundle; import android.view.Gravity; import android.widget.Button; import android.widget.LinearLayout; import android.widget.LinearLayout.LayoutParams; public class progmmatic extends Activity {     @Override     protected void onCreate(Bundle savedInstanceState) {         // TODO Auto-generated method stub         super.onCreate(savedInstanceState);                 //creating a Linear Layout         LinearLayout parent_layout = new LinearLayout(this);        

Multiple Layouts inside a Parent Layout

To show two different layout inside a parent layout we will be working with linear layout. You just need to specify the weight of child layouts. Here goes the code: activity_main.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/rightLayout" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" >

CheckBox in Listview Using Custom Adapter

 In this Application we just need to add a CheckBox along with the TextView. This Tutorial is an extension of ListView Using Custom Adapter  We need the following things: 1. CustomAdapter class 2. DataModel Class 3. MainActivity Class and with these classes we need only two xml files 1. activity_main.xml(xml file for MainActivity.java) 2. row.xml(To hold listview components) Here is your Code : MainActivity.java package com.AndroidDevelopmentGuru.checkbox; import java.util.ArrayList;

What is UTF? and comparision of UTF-8, UTF-16, UTF-32

Before we start discussing about UTF we need to know few basic elements. As we know that we have to encode the human understandable language into machine understandable language. To achieve this objective there are various encoding systems. Few famous encoding systems are enlisted below: ASCII: American Standard Code for information interchange(For United States) ISO 8859-1: Western European Languages KOI-8: for Russian Language

List View And GridView Layout example in Android

Listview Layout MainActivity.java package com.example.layouts; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.Menu; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast; import android.widget.AdapterView.OnItemClickListener; public class MainActivity extends Activity {

Custom Toast in Android

MainActivity.java package com.AndroidDevelopmentGuru.custom_toast; import android.app.Activity; import android.os.Bundle; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.Button; import android.widget.Toast; public class MainActivity extends Activity {     Button btn;     @Override

List inside an Alert Dialog box without using ListView

This blog is to implement the Alert Dialog comprised a list without using ListView. Code goes here. MainActivity.java package com.AndroidDevelopmentGuru.alertbox; import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button public class MainActivity extends Activity {     Button b1;     @Override     protected void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.activity_main);        

SignUp Form with Email Validation

You can use intents to transfer the data from one activity to another using. Below is an example to implement a signup form in Android MainActivity.java package com.AndroidDevelopmentGuru.registeration_form; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.text.TextUtils; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends Activity {     EditText text1,text2,text3,text4,text5;     Button btn;     @Override     protected void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.activity_main);