Android Programming Lecture 4 Activity,Intent and Ul
Android Programming Lecture 4 Activity, Intent and UI
package com.example.editgreeting; import android.app.Activity; Superclass public class MainActivity extends Activity EditText e; TextView t; Button b; protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstancestate); setContentview(R.layout.activity_main); e =(EditText)findViewById(R.id.myEditText); t (Textview)findViewById(R.id.myTextView); b (Button)findViewById(R.id.myButton); Constructor b.setonclickListener(new MyButtonOnclickListener(); class MyButtonOnclickListener implements onclickListener @Override Interface Inner class public void onclick(View v){ /TODO Auto-generated method stub t.setText(e.getText());
2 Superclass Interface Constructor Inner class
RoadMap and Learning Objectives Learn to use the basic Ul widgets Learn to switch Activities using Explicit Intent 3
RoadMap and Learning Objectives • Learn to use the basic UI widgets • Learn to switch Activities using Explicit Intent 3
UI Development
UI Development 4
Basic Input Controls Input controls are used ▣ Button to take data from user ☑ o Widgets Text field OFF -TextView ON ■Button CheckBox -RadioButton Button Smal o年 CheckBox RadioButton Spinner CheckedTextView Spinner o Text Fields o Dialogs 6
Basic Input Controls • Input controls are used to take data from user o Widgets ▪ TextView ▪ Button ▪ CheckBox ▪ RadioButton ▪ Spinner o Text Fields o Dialogs 5