Like Change page
Change activity First we should create a activity,
We should extends class activity and override OnCreate (), then configure information in Androidmainfest.xml.
There importment attrbutes call name and label, name Attrbute tell Android system how to find activity and the label E AUQL the title of the activity.
PackageCom.example.chatdemo;Importandroid.app.Activity;ImportAndroid.os.Bundle;Importandroid.support.v7.app.ActionBarActivity;/*** 1.a activity has to extends activity 1 * 2.override onclreate () method * 3. Configure information on ANDROIDMAINFE St.xml * <activity android:name= "com.example.chatdemo.MainActivity" android:label= "@strin G/app_name "> </activity> this means default activity <intent-filter> <action android:name= "Android.intent.action.MAIN"/> <category android:name= "Android.intent.catego Ry. LAUNCHER "/> </intent-filter> **/ Public classChatextendsactionbaractivity{@Overrideprotected voidonCreate (Bundle savedinstancestate) {Super. OnCreate (savedinstancestate); //Setcontenview () when the execute this activity would dispaly follow layoutSetcontentview (r.layout.chat); }}
If you want go to the activity should set a onclick event
New Intent (); Intent.setclass (this, chat. class ); StartActivity (intent);
Use class Intent Pack activity class finally use Method StartActivity () to start a activity.