Skip to main content

Posts

Showing posts with the label Activity

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 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.

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

ListView Example in Android

To create a simple listview in android as shown in below image, we generally need three things. 1. ListView 2. ArrayAdapter 3. Simple String array. Image 1 activity_main.xml