SlideShare uma empresa Scribd logo
1 de 4
Baixar para ler offline
ºîL™ ݇†ó£Œ† Šó£ªü‚†®¬ù
à¼õ£‚°õ File->New Project-
>Android Project AO‚ ªêŒ»ƒèœ. (ðì‹-1).
AO‚ ªêŒî¾ì¡ ¹Fò ݇†ó£Œ† Šó£
ªü‚† à¼õ£‚°õîŸè£ù F¬ó «î£¡Á‹.
AO‚ ªêŒî£™ Æ
ì™ ªêò™ð£†®Ÿ
è£ù F¬ó‚°
ªê™ô «õ‡´‹. -
ð†ì¬ù AO‚
ªêŒî£™ èNˆî™
ªêò™ð£†®Ÿè£ù
F¬ó‚° ªê™ô
«õ‡´‹.*ð†ì¬ù
AO‚ ªêŒî£™
ªð¼‚è™ ªêò™
𣆮Ÿè£ù F¬ó
‚° ªê™ô «õ‡
´‹. /ð†ì¬ù
AO‚ ªêŒî£™ õ°ˆî™ ªêò™ð£†®Ÿè£ù
F¬ó‚° ªê™ô «õ‡´‹. End ð†ì¬ù AO‚
ÜŠO«èû¡ º®¾‚° õó«õ‡´‹ (ðì‹4).
src->layout->main.xml â¡ø ç¬ðL¬ù «î˜‰
ªî´ƒèœ. Þ‰î F¬óJ™ Graphical Layout
ñŸÁ‹ main.xml â¡Á Þó‡´ HK¾èœ
àœ÷ù. Graphical Layout ðò¡ð´ˆF ïñ‚°
«î¬õò£ù º¡F¬ó ܬñŠH¬ù à¼õ£‚è
º®»‹ (ðì‹ 5). â‚vâ‹â™ ðò¡ð´ˆF»‹
ÜŠO«èû¡ à¼õ£‚°‹ º¬ø
Þ‰î ꣡P™ Project name: arithmatic â¡Á
ªè£´ˆ¶œ«÷£‹. Build TargetJ¬ù Android
2.2 â¡Á «î˜‰ªî´‚è «õ‡´‹. Package
nameâ¡ðF™ com.tc.arithmaticâ¡Á ªè£´‚è
«õ‡´‹.
 à¼õ£‚°‹ ÜŠO«èû¡ å«ó ܬñŠ
H™ Þ¼ŠðîŸè£è Þ‰î º¬ø¬ò ðò¡ð´ˆ¶
A«ø£‹ (ðì‹ 2).
«î¬õò£ù îèõ¬ô ªè£´ˆîH¡¹ finish
ð†ì¬ù AO‚ ªêŒò «õ‡´‹.
arithmatic â¡ø Šó£ªü‚† à¼õ£‚èŠð†
®¼‚°‹.
arithmatic Šó£ªü‚†®¬ù Þó†¬ì AO‚
ªêŒî£™, Ü‰î Šó£ªü‚†®™ àœ÷ ñŸø
ç«ð£™ì˜èœ ñŸÁ‹ ç¬ð™è¬÷ ðŸP ÜP
‰¶ ªè£œ÷ º®»‹. ܬõ src, gen, Android
2.2, assets, res «ð£¡ø ç«ð£™ì˜èÀ‹ ñŸ
Á‹ AndroidManifest.xml, default.properties, pro
guard.cfg â¡ø ç¬ð™è¬÷ ªè£‡®¼‚°‹.
ÜŠO«èû¡ à¼õ£‚°õ res ñŸÁ‹ src
ç«ð£™ì˜èœ ðò¡ð´A¡øù. ñŸø ç«ð£™ì
K™ àœ÷ ç¬ð™èO¡ îèõ™èœ res ç«ð£™
ìK™ àœ÷ ç¬ð™ ðò¡ð£†®Ÿ° ãŸð¾‹,
src ç«ð£™ìK™ àœ÷ ç¬ð™ ðò¡ð´ˆ¶‹
º¬ø‚° ãŸð¾‹ ñ£Áð´‹ (ðì‹ 3).
 à¼õ£‚芫𣰋 ÜŠO«èûQ™
ªñJ¡ F¬ó Þ¼‚°‹. ܉î F¬óJ™ +,-,/,*
-‚è£ù ð†ì¡èœ Þ¼‚°‹. + ð†ì¬ù
(ðì‹-1)
(ðì‹-2)
(ðì‹-3)
Ý¡†ó£Œ´ -2
Þ󣋰ñ£˜ ªô†²Iï£ó£òí¡
03
º¡F¬ó ܬñŠH¬ù
à¼õ£‚è º®»‹. Main
Menu F¬ó¬ò à¼õ£‚°
õîŸè£ù ܬñŠH¬ù
𣘊«ð£‹ (Þƒ° content
1.txt â¡ø ç¬ðL¬ù
ðò¡ð´ˆî «õ‡´‹.
裇è Gó™ 1) Þ‰î ꣡
P™<Linear Layout> ñŸ
Á‹ <Table Layout> ðò¡
ð´ˆF»œ«÷£‹. <Linear
Layout>Íô‹ÝŠªü‚†´
è¬÷ õK¬êò£è ܬñ‚è
«õ‡´‹. <Table Layout>
Íô‹ «ìHœ «ð£¡ø ܬñŠH™ F¬óJ™
ܬñ‚è º®»‹. îèõ¬ô F¬óJ™ 裇HŠ
ð Text View ðò¡ð´Aø¶.
å¼ ßõ¡´ì¡ (Event) ÝŠªü‚®¬ù
ðò¡ð´ˆ¶õ id ðò¡ð´Aø¶. ꣡ø£è,
Þ‰î ðò¡ð£†®™, ºî™ ð†ìQ¡ id-@+id/
button1, Þó‡ì£õ¶ ð†ìQ¡ id-@+id/
button2,Í¡ø£õ¶ð†ìQ¡id-@+id/button3,
è£õ¶ ð†ìQ¡ id-@+id/button4, ä‰î£
õ¶ ð†ìQ¡ id-@+id/button5. Ü´ˆîî£è,
Æ콂è£ù F¬ó à¼õ£‚°õîŸè£ù õN
º¬ø¬ò 𣘊«ð£‹.
Layout->New->Android XML File â¡ð¬î
AO‚ ªêŒî¾ì¡ New Android XML File â¡ø
F¬ó «î£¡Á‹. Þ‰î F¬óJ™ File â¡ðF™
addition.xml â¡Á ªè£´‚è «õ‡´‹.
What type of resource would you like to
create? â¡ðF™ Layout â¡ðî¬ù «î˜‰ªî
´‚è «õ‡´‹. H¡ù˜ Finish ð†ì¬ù AO‚
ªêŒò «õ‡´‹. (ðì‹-6). Þ«î º¬øJ¬ù
ðò¡ð´ˆF subtraction.xml, division.xml, mul
tiplication.xml â¡ø «ôܾ† ç¬ð™è¬÷ à¼
õ£‚è «õ‡´‹.
Ü´ˆîî£èsrc->com.tc.arithmaticâ¡ðî¬ù
AO‚ ªêŒî£™ "ArithmaticActivity.java" â¡ø
ç¬ð™ F¬óJ™ «î£¡Á‹. Þ¶«õ Activity
ç¬ðô£°‹.
嚪õ£¼ «ôܾ† ç¬ðLŸ°‹ å¼
ç¬ðL¬ù à¼õ£‚è «õ‡´‹.
main.xml -‚è£ù Ý‚®M†® Activity ç¬ð™
mainmenujavaâ¡ð‹. (content2.txt)裇è
Gó™2. ÞF™ setcontentview(R.Layout.main)
â¡ø õK ðò¡ð´Aø¶.
Þî¬ùŠ «ð£¡«ø 
à¼õ£‚A»œ÷ addition.
xml-‚° additionActivity.
java â¡ø ç¬ð½‹, sub
traction.xmlŸ°subtraction
Activity.java â¡ø
ç¬ð½‹, multiplication.
xmlŸ° multiplicationActi
vity.java â¡ø ç¬ð½‹,
division.xmlŸ° divisionActi
vity.java. ݇†ó£Œ´
Šó£ªü‚† ªî£ìƒAò¾
ì«ù«ò main.xmlŸè£ù
(ðì‹-4)
(ðì‹-5)
(ðì‹-6)
Content1.txt
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/a
pk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center">
<TextView
android:textAppearance="?android:attr/textApp
earanceSmall"
android:layout_height="wrap_content"
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:text="Main Menu"
android:textSize="55dp"
android:gravity="center"></TextView>
<TableLayout
android:id="@+id/tableLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="+"
android:textSize="35dp"></Button>
<TextView
android:textAppearance="?android:attr/textApp
earanceMedium"
android:id="@+id/textView1"
android:layout_height="wrap_content"
android:text="Addition"
android:layout_width="fill_parent"></TextVi
ew>
</TableRow>
<TableRow
android:id="@+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="35dp"></Button>
<TextView
android:textAppearance="?android:attr/textAp
pearanceMedium"
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Subtraction"></TextView>
</TableRow>
<TableRow
android:id="@+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="X"
android:textSize="35dp"></Button>
<TextView
android:textAppearance="?android:attr/textAp
pearanceMedium"
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Multiplication"></TextView>
</TableRow>
<TableRow
android:id="@+id/tableRow4"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button
android:id="@+id/button4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="/"
android:textSize="35dp"></Button>
<TextView
android:textAppearance="?android:attr/textAp
pearanceMedium"
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Division"></TextView>
</TableRow>
</TableLayout>
<Button android:id="@+id/button5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="End"></Button>
</LinearLayout>
Content2.txt
package com.harsha.world;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.*;
public class mainmenu extends Activity
implements OnClickListener {
Button add,sub,mul,div,endit;
Intent intent = null;
@Override
protected void onCreate(Bundle
savedInstanceState) {
// TODO Auto-generated method
stub
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
add =
(Button)findViewById(R.id.button1);
sub =
(Button)findViewById(R.id.button2);
mul =
(Button)findViewById(R.id.button3);
div =
(Button)findViewById(R.id.button4);
endit =
(Button)findViewById(R.id.button5);
add.setOnClickListener(this);
sub.setOnClickListener(this);
mul.setOnClickListener(this);
div.setOnClickListener(this);
endit.setOnClickListener(this);
}
@Override
public void onClick(View v) {
// TODO Auto-generated method
stub
if(v==add)
{
intent = new
Intent(mainmenu.this,additionActivity.clas
s);
}
if(v==sub)
{
intent = new
Intent(mainmenu.this,subtractionActivity.cl
ass);
}
if(v==mul)
{
Toast.makeText(v.getContext(), "Hello!!
Multiplication Clicked",
Toast.LENGTH_SHORT).show();
intent = new
Intent(mainmenu.this,multiplicationActivity
.class);
}
if(v==div)
{
Toast.makeText(v.getContext(), "Hello!!
Division Clicked",
Toast.LENGTH_SHORT).show();
intent = new
Intent(mainmenu.this,divisionActivity.clas
s);
}
if(v==endit)
{
finish();
}
startActivity(intent);
}
}
- ªî£ì¼‹
Ý‚®M†® ç¬ð™ à¼õ£‚èŠð†®¼‚°‹,
܉î ç¬ðL¬ù 裊H ªêŒ¶ ñŸø ç¬ð™è
¬÷ à¼õ£‚èô£‹.
«ô-ܾ†®™ ð†ì¬ù ü£õ£ ç¬ðL™
ðò¡ð´ˆ¶õFindViewById()ðò¡ð´Aø¶.
꣡ø£è, add=(Button)FindViewById(R.id.but
ton1);
Þî¬ù «ð£¡«ø sub, mul,div ñŸÁ‹ endit
ð†ì¡èÀ‹ ðò¡ð´ˆîŠð†´œ÷ù.
ð†ì¬ù AO‚ ªêŒî¾ì¡ ñŸªø£¼
F¬ó‚° ªê™õ setonclickListener() ðò¡
ð´Aø¶. ꣡ø£è, add.setonclicklistener(this);
Þî¬ù «ð£¡«ø sub, mul,div ñŸÁ‹ endit
ð†ì¡èÀ‚°‹ ðò¡ð´ˆîŠð†´œ÷¶.
(Public void onclidk (view) {} Íô‹ AO‚ ªêŒ
 ï¬ìªðÁ‹ ªêò™è¬÷ õ®õ¬ñ‚è
º®»‹. Üî¬ù ðŸP MKõ£è Ü´ˆî ÞîN™
𣘊«ð£‹.

Mais conteúdo relacionado

Mais procurados

Member Function in C++
Member Function in C++ Member Function in C++
Member Function in C++ NikitaKaur10
 
System Modeling And Achitecture Design
System Modeling And Achitecture DesignSystem Modeling And Achitecture Design
System Modeling And Achitecture DesignDanish Javed
 
09 package diagram
09 package diagram09 package diagram
09 package diagramBaskarkncet
 
Interface specification
Interface specificationInterface specification
Interface specificationmaliksiddique1
 
Introduction to Algorithms & flow charts
Introduction to Algorithms & flow chartsIntroduction to Algorithms & flow charts
Introduction to Algorithms & flow chartsYash Gupta
 
M Suburban Train Ticket System
M Suburban Train Ticket SystemM Suburban Train Ticket System
M Suburban Train Ticket Systemkalpesh1908
 
Introduction to C Language
Introduction to C LanguageIntroduction to C Language
Introduction to C LanguageKamal Acharya
 
OCP Java SE 8 Exam - Sample Questions - Lambda Expressions
OCP Java SE 8 Exam - Sample Questions - Lambda Expressions OCP Java SE 8 Exam - Sample Questions - Lambda Expressions
OCP Java SE 8 Exam - Sample Questions - Lambda Expressions Ganesh Samarthyam
 
Vehicle(car) parking management system user manual by shitalinfotech
Vehicle(car) parking management system user manual  by shitalinfotechVehicle(car) parking management system user manual  by shitalinfotech
Vehicle(car) parking management system user manual by shitalinfotechShitalinfotech
 
SRS of software project lab 1
SRS of software project lab 1SRS of software project lab 1
SRS of software project lab 1Arafat Zaman Anik
 
Railway Reservation System - Requirement Engineering
Railway Reservation System - Requirement EngineeringRailway Reservation System - Requirement Engineering
Railway Reservation System - Requirement EngineeringDanish Javed
 
Batch 21(14,64,66)
Batch 21(14,64,66)Batch 21(14,64,66)
Batch 21(14,64,66)swethadln
 
Statistical Software Quality Assurance.pptx
Statistical Software Quality Assurance.pptxStatistical Software Quality Assurance.pptx
Statistical Software Quality Assurance.pptxKarthigaiSelviS3
 
Introduction to Database Management Systems
Introduction to Database Management Systems Introduction to Database Management Systems
Introduction to Database Management Systems Reem Sherif
 

Mais procurados (20)

Member Function in C++
Member Function in C++ Member Function in C++
Member Function in C++
 
System Modeling And Achitecture Design
System Modeling And Achitecture DesignSystem Modeling And Achitecture Design
System Modeling And Achitecture Design
 
09 package diagram
09 package diagram09 package diagram
09 package diagram
 
Interface specification
Interface specificationInterface specification
Interface specification
 
Introduction to Algorithms & flow charts
Introduction to Algorithms & flow chartsIntroduction to Algorithms & flow charts
Introduction to Algorithms & flow charts
 
M Suburban Train Ticket System
M Suburban Train Ticket SystemM Suburban Train Ticket System
M Suburban Train Ticket System
 
Savitch Ch 02
Savitch Ch 02Savitch Ch 02
Savitch Ch 02
 
Introduction to C Language
Introduction to C LanguageIntroduction to C Language
Introduction to C Language
 
OCP Java SE 8 Exam - Sample Questions - Lambda Expressions
OCP Java SE 8 Exam - Sample Questions - Lambda Expressions OCP Java SE 8 Exam - Sample Questions - Lambda Expressions
OCP Java SE 8 Exam - Sample Questions - Lambda Expressions
 
Types of system software
Types of system softwareTypes of system software
Types of system software
 
Vehicle(car) parking management system user manual by shitalinfotech
Vehicle(car) parking management system user manual  by shitalinfotechVehicle(car) parking management system user manual  by shitalinfotech
Vehicle(car) parking management system user manual by shitalinfotech
 
SRS of software project lab 1
SRS of software project lab 1SRS of software project lab 1
SRS of software project lab 1
 
Railway Reservation System - Requirement Engineering
Railway Reservation System - Requirement EngineeringRailway Reservation System - Requirement Engineering
Railway Reservation System - Requirement Engineering
 
Batch 21(14,64,66)
Batch 21(14,64,66)Batch 21(14,64,66)
Batch 21(14,64,66)
 
Ide description
Ide descriptionIde description
Ide description
 
Methods and constructors in java
Methods and constructors in javaMethods and constructors in java
Methods and constructors in java
 
Statistical Software Quality Assurance.pptx
Statistical Software Quality Assurance.pptxStatistical Software Quality Assurance.pptx
Statistical Software Quality Assurance.pptx
 
Employee Management System
Employee Management SystemEmployee Management System
Employee Management System
 
Introduction to Database Management Systems
Introduction to Database Management Systems Introduction to Database Management Systems
Introduction to Database Management Systems
 
User Interface
User InterfaceUser Interface
User Interface
 

Destaque

01 what is android
01 what is android01 what is android
01 what is androidC.o. Nieto
 
Advanced Android Fragments, Tom Opgenorth
Advanced Android Fragments, Tom OpgenorthAdvanced Android Fragments, Tom Opgenorth
Advanced Android Fragments, Tom OpgenorthXamarin
 
Qur'an Memorization Plan - One Ayah Per Day
Qur'an Memorization Plan - One Ayah Per Day Qur'an Memorization Plan - One Ayah Per Day
Qur'an Memorization Plan - One Ayah Per Day MuQeet
 
Android fundamentals and tutorial for beginners
Android fundamentals and tutorial for beginnersAndroid fundamentals and tutorial for beginners
Android fundamentals and tutorial for beginnersBoom Shukla
 
Bus tracking application project report
Bus tracking application project reportBus tracking application project report
Bus tracking application project reportAbhishek Singh
 
Bus tracking application in Android
Bus tracking application in AndroidBus tracking application in Android
Bus tracking application in Androidyashonil
 
TEDx Manchester: AI & The Future of Work
TEDx Manchester: AI & The Future of WorkTEDx Manchester: AI & The Future of Work
TEDx Manchester: AI & The Future of WorkVolker Hirsch
 

Destaque (16)

Android app - Creating Live Wallpaper (tamil)
Android app - Creating Live Wallpaper (tamil)Android app - Creating Live Wallpaper (tamil)
Android app - Creating Live Wallpaper (tamil)
 
Create Android App using web view (in tamil)
Create Android App using web view (in tamil)Create Android App using web view (in tamil)
Create Android App using web view (in tamil)
 
Hardware Interface in Android (in tamil)
Hardware Interface in Android (in tamil)Hardware Interface in Android (in tamil)
Hardware Interface in Android (in tamil)
 
IT security awareness
IT security awarenessIT security awareness
IT security awareness
 
01 what is android
01 what is android01 what is android
01 what is android
 
Rating Bar in Android Example
Rating Bar in Android ExampleRating Bar in Android Example
Rating Bar in Android Example
 
Advanced Android Fragments, Tom Opgenorth
Advanced Android Fragments, Tom OpgenorthAdvanced Android Fragments, Tom Opgenorth
Advanced Android Fragments, Tom Opgenorth
 
Ramadan
RamadanRamadan
Ramadan
 
Sahih muslim tamil
Sahih muslim tamilSahih muslim tamil
Sahih muslim tamil
 
Normalisation revision
Normalisation revisionNormalisation revision
Normalisation revision
 
Qur'an Memorization Plan - One Ayah Per Day
Qur'an Memorization Plan - One Ayah Per Day Qur'an Memorization Plan - One Ayah Per Day
Qur'an Memorization Plan - One Ayah Per Day
 
Android fundamentals and tutorial for beginners
Android fundamentals and tutorial for beginnersAndroid fundamentals and tutorial for beginners
Android fundamentals and tutorial for beginners
 
Bus tracking application project report
Bus tracking application project reportBus tracking application project report
Bus tracking application project report
 
Tourist Places of India
Tourist Places of IndiaTourist Places of India
Tourist Places of India
 
Bus tracking application in Android
Bus tracking application in AndroidBus tracking application in Android
Bus tracking application in Android
 
TEDx Manchester: AI & The Future of Work
TEDx Manchester: AI & The Future of WorkTEDx Manchester: AI & The Future of Work
TEDx Manchester: AI & The Future of Work
 

Mais de Dr. Ramkumar Lakshminarayanan

Using many languages in single Android App (in tamil)
Using many languages in single Android App (in tamil)Using many languages in single Android App (in tamil)
Using many languages in single Android App (in tamil)Dr. Ramkumar Lakshminarayanan
 

Mais de Dr. Ramkumar Lakshminarayanan (20)

Basics of IT security
Basics of IT securityBasics of IT security
Basics of IT security
 
IT Security Awareness Posters
IT Security Awareness PostersIT Security Awareness Posters
IT Security Awareness Posters
 
Windows mobile programming
Windows mobile programmingWindows mobile programming
Windows mobile programming
 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
 
Web technology today
Web technology todayWeb technology today
Web technology today
 
Php Tutorial
Php TutorialPhp Tutorial
Php Tutorial
 
Phonegap for Android
Phonegap for AndroidPhonegap for Android
Phonegap for Android
 
Create and Sell Android App (in tamil)
Create and Sell Android App (in tamil)Create and Sell Android App (in tamil)
Create and Sell Android App (in tamil)
 
Android Tips (Tamil)
Android Tips (Tamil)Android Tips (Tamil)
Android Tips (Tamil)
 
Android Animation (in tamil)
Android Animation (in tamil)Android Animation (in tamil)
Android Animation (in tamil)
 
Creating List in Android App (in tamil)
Creating List in Android App (in tamil)Creating List in Android App (in tamil)
Creating List in Android App (in tamil)
 
Single Touch event view in Android (in tamil)
Single Touch event view in Android (in tamil)Single Touch event view in Android (in tamil)
Single Touch event view in Android (in tamil)
 
Android Application using seekbar (in tamil)
Android Application using seekbar (in tamil)Android Application using seekbar (in tamil)
Android Application using seekbar (in tamil)
 
Creating Image Gallery - Android app (in tamil)
Creating Image Gallery - Android app (in tamil)Creating Image Gallery - Android app (in tamil)
Creating Image Gallery - Android app (in tamil)
 
GPS in Android (in tamil)
GPS in Android (in tamil)GPS in Android (in tamil)
GPS in Android (in tamil)
 
Using many languages in single Android App (in tamil)
Using many languages in single Android App (in tamil)Using many languages in single Android App (in tamil)
Using many languages in single Android App (in tamil)
 
SQLite in Android App (in tamil)
SQLite in Android App (in tamil)SQLite in Android App (in tamil)
SQLite in Android App (in tamil)
 
Shared Preference in Android App
Shared Preference in Android AppShared Preference in Android App
Shared Preference in Android App
 
Data Storage in Android App
Data Storage in Android AppData Storage in Android App
Data Storage in Android App
 
Part 7
Part 7Part 7
Part 7
 

Creating Sample Android App (in tamil)

  • 1. ºîL™ ݇†ó£Œ† Šó£ªü‚†®¬ù à¼õ£‚°õ File->New Project- >Android Project AO‚ ªêŒ»ƒèœ. (ðì‹-1). AO‚ ªêŒî¾ì¡ ¹Fò ݇†ó£Œ† Šó£ ªü‚† à¼õ£‚°õîŸè£ù F¬ó «î£¡Á‹. AO‚ ªêŒî£™ Æ ì™ ªêò™ð£†®Ÿ è£ù F¬ó‚° ªê™ô «õ‡´‹. - ð†ì¬ù AO‚ ªêŒî£™ èNˆî™ ªêò™ð£†®Ÿè£ù F¬ó‚° ªê™ô «õ‡´‹.*ð†ì¬ù AO‚ ªêŒî£™ ªð¼‚è™ ªêò™ 𣆮Ÿè£ù F¬ó ‚° ªê™ô «õ‡ ´‹. /ð†ì¬ù AO‚ ªêŒî£™ õ°ˆî™ ªêò™ð£†®Ÿè£ù F¬ó‚° ªê™ô «õ‡´‹. End ð†ì¬ù AO‚ ÜŠO«èû¡ º®¾‚° õó«õ‡´‹ (ðì‹4). src->layout->main.xml â¡ø ç¬ðL¬ù «î˜‰ ªî´ƒèœ. Þ‰î F¬óJ™ Graphical Layout ñŸÁ‹ main.xml â¡Á Þó‡´ HK¾èœ àœ÷ù. Graphical Layout ðò¡ð´ˆF ïñ‚° «î¬õò£ù º¡F¬ó ܬñŠH¬ù à¼õ£‚è º®»‹ (ðì‹ 5). â‚vâ‹â™ ðò¡ð´ˆF»‹ ÜŠO«èû¡ à¼õ£‚°‹ º¬ø Þ‰î ꣡P™ Project name: arithmatic â¡Á ªè£´ˆ¶œ«÷£‹. Build TargetJ¬ù Android 2.2 â¡Á «î˜‰ªî´‚è «õ‡´‹. Package nameâ¡ðF™ com.tc.arithmaticâ¡Á ªè£´‚è «õ‡´‹.  à¼õ£‚°‹ ÜŠO«èû¡ å«ó ܬñŠ H™ Þ¼ŠðîŸè£è Þ‰î º¬ø¬ò ðò¡ð´ˆ¶ A«ø£‹ (ðì‹ 2). «î¬õò£ù îèõ¬ô ªè£´ˆîH¡¹ finish ð†ì¬ù AO‚ ªêŒò «õ‡´‹. arithmatic â¡ø Šó£ªü‚† à¼õ£‚èŠð† ®¼‚°‹. arithmatic Šó£ªü‚†®¬ù Þó†¬ì AO‚ ªêŒî£™, Ü‰î Šó£ªü‚†®™ àœ÷ ñŸø ç«ð£™ì˜èœ ñŸÁ‹ ç¬ð™è¬÷ ðŸP ÜP ‰¶ ªè£œ÷ º®»‹. ܬõ src, gen, Android 2.2, assets, res «ð£¡ø ç«ð£™ì˜èÀ‹ ñŸ Á‹ AndroidManifest.xml, default.properties, pro guard.cfg â¡ø ç¬ð™è¬÷ ªè£‡®¼‚°‹. ÜŠO«èû¡ à¼õ£‚°õ res ñŸÁ‹ src ç«ð£™ì˜èœ ðò¡ð´A¡øù. ñŸø ç«ð£™ì K™ àœ÷ ç¬ð™èO¡ îèõ™èœ res ç«ð£™ ìK™ àœ÷ ç¬ð™ ðò¡ð£†®Ÿ° ãŸð¾‹, src ç«ð£™ìK™ àœ÷ ç¬ð™ ðò¡ð´ˆ¶‹ º¬ø‚° ãŸð¾‹ ñ£Áð´‹ (ðì‹ 3).  à¼õ£‚芫𣰋 ÜŠO«èûQ™ ªñJ¡ F¬ó Þ¼‚°‹. ܉î F¬óJ™ +,-,/,* -‚è£ù ð†ì¡èœ Þ¼‚°‹. + ð†ì¬ù (ðì‹-1) (ðì‹-2) (ðì‹-3)
  • 2. Ý¡†ó£Œ´ -2 Þ󣋰ñ£˜ ªô†²Iï£ó£òí¡ 03 º¡F¬ó ܬñŠH¬ù à¼õ£‚è º®»‹. Main Menu F¬ó¬ò à¼õ£‚° õîŸè£ù ܬñŠH¬ù 𣘊«ð£‹ (Þƒ° content 1.txt â¡ø ç¬ðL¬ù ðò¡ð´ˆî «õ‡´‹. 裇è Gó™ 1) Þ‰î ꣡ P™<Linear Layout> ñŸ Á‹ <Table Layout> ðò¡ ð´ˆF»œ«÷£‹. <Linear Layout>Íô‹ÝŠªü‚†´ è¬÷ õK¬êò£è ܬñ‚è «õ‡´‹. <Table Layout> Íô‹ «ìHœ «ð£¡ø ܬñŠH™ F¬óJ™ ܬñ‚è º®»‹. îèõ¬ô F¬óJ™ 裇HŠ ð Text View ðò¡ð´Aø¶. å¼ ßõ¡´ì¡ (Event) ÝŠªü‚®¬ù ðò¡ð´ˆ¶õ id ðò¡ð´Aø¶. ꣡ø£è, Þ‰î ðò¡ð£†®™, ºî™ ð†ìQ¡ id-@+id/ button1, Þó‡ì£õ¶ ð†ìQ¡ id-@+id/ button2,Í¡ø£õ¶ð†ìQ¡id-@+id/button3, è£õ¶ ð†ìQ¡ id-@+id/button4, ä‰î£ õ¶ ð†ìQ¡ id-@+id/button5. Ü´ˆîî£è, Æ콂è£ù F¬ó à¼õ£‚°õîŸè£ù õN º¬ø¬ò 𣘊«ð£‹. Layout->New->Android XML File â¡ð¬î AO‚ ªêŒî¾ì¡ New Android XML File â¡ø F¬ó «î£¡Á‹. Þ‰î F¬óJ™ File â¡ðF™ addition.xml â¡Á ªè£´‚è «õ‡´‹. What type of resource would you like to create? â¡ðF™ Layout â¡ðî¬ù «î˜‰ªî ´‚è «õ‡´‹. H¡ù˜ Finish ð†ì¬ù AO‚ ªêŒò «õ‡´‹. (ðì‹-6). Þ«î º¬øJ¬ù ðò¡ð´ˆF subtraction.xml, division.xml, mul tiplication.xml â¡ø «ôܾ† ç¬ð™è¬÷ ༠õ£‚è «õ‡´‹. Ü´ˆîî£èsrc->com.tc.arithmaticâ¡ðî¬ù AO‚ ªêŒî£™ "ArithmaticActivity.java" â¡ø ç¬ð™ F¬óJ™ «î£¡Á‹. Þ¶«õ Activity ç¬ðô£°‹. 嚪õ£¼ «ôܾ† ç¬ðLŸ°‹ å¼ ç¬ðL¬ù à¼õ£‚è «õ‡´‹. main.xml -‚è£ù Ý‚®M†® Activity ç¬ð™ mainmenujavaâ¡ð‹. (content2.txt)裇è Gó™2. ÞF™ setcontentview(R.Layout.main) â¡ø õK ðò¡ð´Aø¶. Þî¬ùŠ «ð£¡«ø  à¼õ£‚A»œ÷ addition. xml-‚° additionActivity. java â¡ø ç¬ð½‹, sub traction.xmlŸ°subtraction Activity.java â¡ø ç¬ð½‹, multiplication. xmlŸ° multiplicationActi vity.java â¡ø ç¬ð½‹, division.xmlŸ° divisionActi vity.java. ݇†ó£Œ´ Šó£ªü‚† ªî£ìƒAò¾ ì«ù«ò main.xmlŸè£ù (ðì‹-4) (ðì‹-5) (ðì‹-6)
  • 3. Content1.txt <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/a pk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center" android:gravity="center"> <TextView android:textAppearance="?android:attr/textApp earanceSmall" android:layout_height="wrap_content" android:id="@+id/textView5" android:layout_width="wrap_content" android:text="Main Menu" android:textSize="55dp" android:gravity="center"></TextView> <TableLayout android:id="@+id/tableLayout1" android:layout_width="fill_parent" android:layout_height="wrap_content"> <TableRow android:id="@+id/tableRow1" android:layout_width="wrap_content" android:layout_height="wrap_content"> <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="+" android:textSize="35dp"></Button> <TextView android:textAppearance="?android:attr/textApp earanceMedium" android:id="@+id/textView1" android:layout_height="wrap_content" android:text="Addition" android:layout_width="fill_parent"></TextVi ew> </TableRow> <TableRow android:id="@+id/tableRow2" android:layout_width="wrap_content" android:layout_height="wrap_content"> <Button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="-" android:textSize="35dp"></Button> <TextView android:textAppearance="?android:attr/textAp pearanceMedium" android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Subtraction"></TextView> </TableRow> <TableRow android:id="@+id/tableRow3" android:layout_width="wrap_content" android:layout_height="wrap_content"> <Button android:id="@+id/button3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="X" android:textSize="35dp"></Button> <TextView android:textAppearance="?android:attr/textAp pearanceMedium" android:id="@+id/textView3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Multiplication"></TextView> </TableRow> <TableRow android:id="@+id/tableRow4" android:layout_width="wrap_content" android:layout_height="wrap_content"> <Button android:id="@+id/button4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="/" android:textSize="35dp"></Button> <TextView android:textAppearance="?android:attr/textAp pearanceMedium" android:id="@+id/textView4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Division"></TextView> </TableRow> </TableLayout> <Button android:id="@+id/button5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="End"></Button> </LinearLayout>
  • 4. Content2.txt package com.harsha.world; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.*; public class mainmenu extends Activity implements OnClickListener { Button add,sub,mul,div,endit; Intent intent = null; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.main); add = (Button)findViewById(R.id.button1); sub = (Button)findViewById(R.id.button2); mul = (Button)findViewById(R.id.button3); div = (Button)findViewById(R.id.button4); endit = (Button)findViewById(R.id.button5); add.setOnClickListener(this); sub.setOnClickListener(this); mul.setOnClickListener(this); div.setOnClickListener(this); endit.setOnClickListener(this); } @Override public void onClick(View v) { // TODO Auto-generated method stub if(v==add) { intent = new Intent(mainmenu.this,additionActivity.clas s); } if(v==sub) { intent = new Intent(mainmenu.this,subtractionActivity.cl ass); } if(v==mul) { Toast.makeText(v.getContext(), "Hello!! Multiplication Clicked", Toast.LENGTH_SHORT).show(); intent = new Intent(mainmenu.this,multiplicationActivity .class); } if(v==div) { Toast.makeText(v.getContext(), "Hello!! Division Clicked", Toast.LENGTH_SHORT).show(); intent = new Intent(mainmenu.this,divisionActivity.clas s); } if(v==endit) { finish(); } startActivity(intent); } } - ªî£ì¼‹ Ý‚®M†® ç¬ð™ à¼õ£‚èŠð†®¼‚°‹, ܉î ç¬ðL¬ù 裊H ªêŒ¶ ñŸø ç¬ð™è ¬÷ à¼õ£‚èô£‹. «ô-ܾ†®™ ð†ì¬ù ü£õ£ ç¬ðL™ ðò¡ð´ˆ¶õFindViewById()ðò¡ð´Aø¶. ꣡ø£è, add=(Button)FindViewById(R.id.but ton1); Þî¬ù «ð£¡«ø sub, mul,div ñŸÁ‹ endit ð†ì¡èÀ‹ ðò¡ð´ˆîŠð†´œ÷ù. ð†ì¬ù AO‚ ªêŒî¾ì¡ ñŸªø£¼ F¬ó‚° ªê™õ setonclickListener() ðò¡ ð´Aø¶. ꣡ø£è, add.setonclicklistener(this); Þî¬ù «ð£¡«ø sub, mul,div ñŸÁ‹ endit ð†ì¡èÀ‚°‹ ðò¡ð´ˆîŠð†´œ÷¶. (Public void onclidk (view) {} Íô‹ AO‚ ªêŒ  ï¬ìªðÁ‹ ªêò™è¬÷ õ®õ¬ñ‚è º®»‹. Üî¬ù ðŸP MKõ£è Ü´ˆî ÞîN™ 𣘊«ð£‹.