Skip to main content

Posts

Showing posts from September, 2015

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;                 Cursor cursor;                                 @Override                 protected void onCreate(Bundle savedInstanceState) {                                 super.onCreate(savedInstanceState);                                 setContentView(R.layout.activity_main);

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);    

ListView Using CustomAdapter with setter getter method

For this we need following three classes Main Class where we would be implementing listview using custom Adapter(CustomAdapterExample.java) Second Class for designing our Custom Adapter(CustomAdapter.java) And the last one for getter setter method for data transfer(User.java) Along with these three java classes we need two xml file one would be default xml file (activity_custom_adapter_example.xml) for main class and another one for making Listview layout (simple_list_items.xml)  In activity_custom_adapter_example.xml, take a ListView element from the Widgets and in simple_list_items.xml, take two textviews.

ListView Using SqLite Database

MainActivity.Java package com.example.nikk.nikkukaushik; import android.app.DatePickerDialog; import android.app.Dialog; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.DatePicker; import android.widget.EditText; import android.widget.ImageButton; import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; import java.util.Calendar; import java.util.List; public class MainActivity extends ActionBarActivity implements View.OnClickListener,AdapterView.OnItemSelectedListener{     MyDataHelper data1=new MyDataHelper(this);     int pos;     private ImageButton ib;     private Calendar cal;     private int day;     private int month;     private