SlideShare une entreprise Scribd logo
1  sur  20
Télécharger pour lire hors ligne
Application Development
Overview on Android OS
Kanak & Pankaj
Overview/Design Guidelines
• A Mobile Operating System
• Uses a modified version of the Linux kernel
• Allows developers to write code in java language
• Third party application can be built using java and
android framework
Android 2.1 & Above
With
Eclipse IDE
Overview/Design Guidelines
What's in an App
Starting with the Project
Layouts & Screen Sizes
• FrameLayout
Layout that acts as a view frame to display a single object.
• LinearLayout
A layout that organizes its children into a single horizontal or vertical row. It creates
a scrollbar if the length of the window exceeds the length of the screen.
• RelativeLayout
Enables you to specify the location of child objects relative to each other (child A
to the left of child B) or to the parent (aligned to the top of the parent).
• ListView
Displays a scrolling single column list.
Common Layouts
• ScrollView
A vertically scrolling column of elements. Spinner Displays a single item at a time
from a bound list, inside a one-row textbox. Rather like a one-row
• TabHost
It provides a tab selection list that monitors clicks and enables the application to
change the screen whenever a tab is clicked.
• TableLayout
A tabular layout with an arbitrary number of rows and columns, each cell holding
the widget of your choice. The rows resize to fit the largest column. The cell
borders are not visible.
Layouts & Screen Sizes
Common Layouts
Layouts & Screen Sizes
Screen Sizes
Android runs on a variety of devices that offer different
screen sizes and densities
• xlarge screens are at least 960dp x 720dp
• large screens are at least 640dp x 480dp
• normal screens are at least 470dp x 320dp
• small screens are at least 426dp x 320dp
To support multiple screen size
• Explicitly declare in the manifest which screen sizes your application
supports
• Provide different layouts for different screen sizes
• Provide different bitmap drawables for different screen densities
Layouts & Screen Sizes
Screen Sizes
Manifest parameters for Screen sizes
<supports-screens android:resizeable=["true"| "false"]
android:smallScreens=["true" | "false"]
android:normalScreens=["true" | "false"]
android:largeScreens=["true" | "false"]
android:xlargeScreens=["true" | "false"]
android:anyDensity=["true" | "false"]
android:requiresSmallestWidthDp="integer"
android:compatibleWidthLimitDp="integer"
android:largestWidthLimitDp="integer"/>
Challenges faced while building
Naukri App
• Installing SDK for different Version of Android
• Choosing right IDE for development
• Using Spinner to choose value from the dropdown on runtime and from
set of array
• Calling spinner on clicking ImageView
• Choosing right layout to build XML
• Optimizing layout and making it re-usable
• Saving preferences
• Implementing multiple clicks on single activity
• Calling multiple activity for result on single activity
• Creating complete view on runtime
• Finishing activities correctly
Setting Up an Activity to set
background image and music
Background can contain image as well as music. Their time out can be handled
using simple threads in java.
Permissions Required –
<uses-permission android:name="android.permission.SET_WALLPAPER"></uses-
permission>
Setting up the Content View –
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.amazing);
}
Introduction to Media Player and Sound Pool –
MediaPlayer theSong = MediaPlayer.create(this, R.raw.uninvited);
theSong.start();
theSong.release();
Setting Up an Activity to set
background image and music
On pause Activity –
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
//theSong.stop(); // ---- this is same as Mediaplayer.release() the only
differnece is release method releases the other objects related to it and stop
method abruptly stops the object
theSong.release();
finish();
}
Creating a LIST/MENU and referencing
the selected Item
Extending ListActivity instead of Activity
Setting List –
ArrayAdapter<String> adapter = new ArrayAdapter<String>(MenuApp.this,
android.R.layout.simple_list_item_1, classes);
setListAdapter(adapter);
OnListItemClick()
Setting MenuKey –
MenuInflater blowUp = getMenuInflater();
blowUp.inflate(R.menu.cool_menu, menu);
OnOptionsItemSelected()
Setting Up buttons and text views
Button add = (Button) findViewById(R.id.bAdd);
Button sub = (Button) findViewById(R.id.bSub);
TextView display = (TextView) findViewById(R.id.tvDisplay);
Setting onClickListeners() for button clicks –
add.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
counter++;
display.setText("Your Total is: " + counter);
//display.setText(Integer.toString(counter));
}
});
Setting Up buttons and text views
sub.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
counter--;
display.setText("Your total is : " + counter);
}
});
SETTING UP A FORM WITH EDITBOXES
AND TOGGLE BUTTON AND
SIMPLE BUTTONS
final ToggleButton passTog = (ToggleButton) findViewById(R.id.tbPassword);
final EditText Name = (EditText) findViewById(R.id.etName);
final EditText MobNum = (EditText) findViewById(R.id.etMobileNumber);
final EditText EmailId = (EditText) findViewById(R.id.etEmailID);
final EditText Password = (EditText) findViewById(R.id.etPassword);
SETTING UP A FORM WITH EDITBOXES AND
TOGGLE BUTTON AND SIMPLE BUTTONS
Setting the input type for password field on the basis of toggle button-
passTog.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
if(passTog.isChecked()){
Password.setInputType(InputType.TYPE_CLASS_TEXT |
InputType.TYPE_TEXT_VARIATION_PASSWORD);
}else{
Password.setInputType(InputType.TYPE_CLASS_TEXT);
}
}
});
SETTING UP A FORM WITH EDITBOXES AND
TOGGLE BUTTON AND SIMPLE BUTTONS
Setting Alert Boxes –
new AlertDialog.Builder(TextActs.this)
.setMessage("Please fill in the valid email address,
mobile number and password should be minimum 6 characters long")
.setTitle("Validation Error")
.setCancelable(true)
.setNeutralButton(android.R.string.ok,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int
whichButton){}
})
.show();
SENDING AN EMAIL FROM APPLICATION
Permission Required –
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
Setting Up Email intent –
String emailaddress[] = { emailAdd };
String message = “Some MEssage";
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, emailaddress);
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "I hate you!");
emailIntent.setType("plain/text");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, message);
startActivity(emailIntent);
SAVING PREFERENCES
Preferences in Androids are like cookies on browsers which are saved in
the phone memory and can be accessed any time during the application.
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<EditTextPreference android:title="Edit Text”android:key="name"
android:summary="Enter your name” />
<CheckBoxPreference android:title="Music” android:defaultValue="true"
android:key="checkbox” android:summary="for the start screen">
</CheckBoxPreference>
<ListPreference android:title="list” android:key="list” android:summary="Choose from”
android:entries="@array/list” android:entryValues="@array/lValues"
></ListPreference>
</PreferenceScreen>
Questions/Comments
?

Contenu connexe

Tendances

Android ui layout
Android ui layoutAndroid ui layout
Android ui layoutKrazy Koder
 
Five android architecture
Five android architectureFive android architecture
Five android architectureTomislav Homan
 
Android In A Nutshell
Android In A NutshellAndroid In A Nutshell
Android In A NutshellTed Chien
 
android layouts
android layoutsandroid layouts
android layoutsDeepa Rani
 
Android apps development
Android apps developmentAndroid apps development
Android apps developmentRaman Pandey
 
Android Development in a Nutshell
Android Development in a NutshellAndroid Development in a Nutshell
Android Development in a NutshellAleix Solé
 
Android application-component
Android application-componentAndroid application-component
Android application-componentLy Haza
 
Android Screen Containers & Layouts
Android Screen Containers & LayoutsAndroid Screen Containers & Layouts
Android Screen Containers & LayoutsVijay Rastogi
 
Android studio 2.0: default project structure
Android studio 2.0: default project structureAndroid studio 2.0: default project structure
Android studio 2.0: default project structureVyara Georgieva
 
01 what is android
01 what is android01 what is android
01 what is androidC.o. Nieto
 
04 user interfaces
04 user interfaces04 user interfaces
04 user interfacesC.o. Nieto
 
Marakana Android User Interface
Marakana Android User InterfaceMarakana Android User Interface
Marakana Android User InterfaceMarko Gargenta
 
Marakana android-java developers
Marakana android-java developersMarakana android-java developers
Marakana android-java developersMarko Gargenta
 
Android Tutorial
Android TutorialAndroid Tutorial
Android TutorialFun2Do Labs
 
01 11 - graphical user interface - fonts-web-tab
01  11 - graphical user interface - fonts-web-tab01  11 - graphical user interface - fonts-web-tab
01 11 - graphical user interface - fonts-web-tabSiva Kumar reddy Vasipally
 
Android application development for TresmaxAsia
Android application development for TresmaxAsiaAndroid application development for TresmaxAsia
Android application development for TresmaxAsiaMichael Angelo Rivera
 

Tendances (20)

Android ui layout
Android ui layoutAndroid ui layout
Android ui layout
 
Five android architecture
Five android architectureFive android architecture
Five android architecture
 
Android In A Nutshell
Android In A NutshellAndroid In A Nutshell
Android In A Nutshell
 
android layouts
android layoutsandroid layouts
android layouts
 
Android apps development
Android apps developmentAndroid apps development
Android apps development
 
Android Development in a Nutshell
Android Development in a NutshellAndroid Development in a Nutshell
Android Development in a Nutshell
 
Android application-component
Android application-componentAndroid application-component
Android application-component
 
Android Screen Containers & Layouts
Android Screen Containers & LayoutsAndroid Screen Containers & Layouts
Android Screen Containers & Layouts
 
Training android
Training androidTraining android
Training android
 
Android studio 2.0: default project structure
Android studio 2.0: default project structureAndroid studio 2.0: default project structure
Android studio 2.0: default project structure
 
Android Anatomy
Android  AnatomyAndroid  Anatomy
Android Anatomy
 
Ios - Introduction to platform & SDK
Ios - Introduction to platform & SDKIos - Introduction to platform & SDK
Ios - Introduction to platform & SDK
 
01 what is android
01 what is android01 what is android
01 what is android
 
04 user interfaces
04 user interfaces04 user interfaces
04 user interfaces
 
Marakana Android User Interface
Marakana Android User InterfaceMarakana Android User Interface
Marakana Android User Interface
 
Marakana android-java developers
Marakana android-java developersMarakana android-java developers
Marakana android-java developers
 
Android Tutorial
Android TutorialAndroid Tutorial
Android Tutorial
 
Android components
Android componentsAndroid components
Android components
 
01 11 - graphical user interface - fonts-web-tab
01  11 - graphical user interface - fonts-web-tab01  11 - graphical user interface - fonts-web-tab
01 11 - graphical user interface - fonts-web-tab
 
Android application development for TresmaxAsia
Android application development for TresmaxAsiaAndroid application development for TresmaxAsia
Android application development for TresmaxAsia
 

Similaire à Application Development - Overview on Android OS

01 09 - graphical user interface - basic widgets
01  09 - graphical user interface - basic widgets01  09 - graphical user interface - basic widgets
01 09 - graphical user interface - basic widgetsSiva Kumar reddy Vasipally
 
Getting Started With Material Design
Getting Started With Material DesignGetting Started With Material Design
Getting Started With Material DesignYasin Yildirim
 
viWave Study Group - Introduction to Google Android Development - Chapter 23 ...
viWave Study Group - Introduction to Google Android Development - Chapter 23 ...viWave Study Group - Introduction to Google Android Development - Chapter 23 ...
viWave Study Group - Introduction to Google Android Development - Chapter 23 ...Ted Chien
 
Unit 2 LayoutTutorial.pptx
Unit 2 LayoutTutorial.pptxUnit 2 LayoutTutorial.pptx
Unit 2 LayoutTutorial.pptxABHIKKUMARDE
 
Android_Bootcamp_PPT_GDSC_ITS_Engineering
Android_Bootcamp_PPT_GDSC_ITS_EngineeringAndroid_Bootcamp_PPT_GDSC_ITS_Engineering
Android_Bootcamp_PPT_GDSC_ITS_EngineeringShivanshSeth6
 
Training Session 2 - Day 2
Training Session 2 - Day 2Training Session 2 - Day 2
Training Session 2 - Day 2Vivek Bhusal
 
Android App development and test environment, Understaing android app structure
Android App development and test environment, Understaing android app structureAndroid App development and test environment, Understaing android app structure
Android App development and test environment, Understaing android app structureVijay Rastogi
 
Android Development Made Easy - With Sample Project
Android Development Made Easy - With Sample ProjectAndroid Development Made Easy - With Sample Project
Android Development Made Easy - With Sample ProjectJoemarie Amparo
 
Android Workshop
Android WorkshopAndroid Workshop
Android WorkshopJunda Ong
 
User experience and interactions design
User experience and interactions design User experience and interactions design
User experience and interactions design Rakesh Jha
 
MOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentMOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentanistar sung
 
Beginning Native Android Apps
Beginning Native Android AppsBeginning Native Android Apps
Beginning Native Android AppsGil Irizarry
 
Ch4 creating user interfaces
Ch4 creating user interfacesCh4 creating user interfaces
Ch4 creating user interfacesShih-Hsiang Lin
 
Android development for iOS developers
Android development for iOS developersAndroid development for iOS developers
Android development for iOS developersDarryl Bayliss
 

Similaire à Application Development - Overview on Android OS (20)

01 09 - graphical user interface - basic widgets
01  09 - graphical user interface - basic widgets01  09 - graphical user interface - basic widgets
01 09 - graphical user interface - basic widgets
 
Android
AndroidAndroid
Android
 
Android UI Development
Android UI DevelopmentAndroid UI Development
Android UI Development
 
Getting Started With Material Design
Getting Started With Material DesignGetting Started With Material Design
Getting Started With Material Design
 
viWave Study Group - Introduction to Google Android Development - Chapter 23 ...
viWave Study Group - Introduction to Google Android Development - Chapter 23 ...viWave Study Group - Introduction to Google Android Development - Chapter 23 ...
viWave Study Group - Introduction to Google Android Development - Chapter 23 ...
 
Unit 2 LayoutTutorial.pptx
Unit 2 LayoutTutorial.pptxUnit 2 LayoutTutorial.pptx
Unit 2 LayoutTutorial.pptx
 
Android_Bootcamp_PPT_GDSC_ITS_Engineering
Android_Bootcamp_PPT_GDSC_ITS_EngineeringAndroid_Bootcamp_PPT_GDSC_ITS_Engineering
Android_Bootcamp_PPT_GDSC_ITS_Engineering
 
Training Session 2 - Day 2
Training Session 2 - Day 2Training Session 2 - Day 2
Training Session 2 - Day 2
 
Ap quiz app
Ap quiz appAp quiz app
Ap quiz app
 
Android App development and test environment, Understaing android app structure
Android App development and test environment, Understaing android app structureAndroid App development and test environment, Understaing android app structure
Android App development and test environment, Understaing android app structure
 
Android Development Made Easy - With Sample Project
Android Development Made Easy - With Sample ProjectAndroid Development Made Easy - With Sample Project
Android Development Made Easy - With Sample Project
 
Android Workshop
Android WorkshopAndroid Workshop
Android Workshop
 
User experience and interactions design
User experience and interactions design User experience and interactions design
User experience and interactions design
 
Android classes in mumbai
Android classes in mumbaiAndroid classes in mumbai
Android classes in mumbai
 
MOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentMOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app development
 
Android programming basics
Android programming basicsAndroid programming basics
Android programming basics
 
Beginning Native Android Apps
Beginning Native Android AppsBeginning Native Android Apps
Beginning Native Android Apps
 
Ch4 creating user interfaces
Ch4 creating user interfacesCh4 creating user interfaces
Ch4 creating user interfaces
 
Chapter 5 - Layouts
Chapter 5 - LayoutsChapter 5 - Layouts
Chapter 5 - Layouts
 
Android development for iOS developers
Android development for iOS developersAndroid development for iOS developers
Android development for iOS developers
 

Dernier

Computer 10 Lesson 8: Building a Website
Computer 10 Lesson 8: Building a WebsiteComputer 10 Lesson 8: Building a Website
Computer 10 Lesson 8: Building a WebsiteMavein
 
Check out the Free Landing Page Hosting in 2024
Check out the Free Landing Page Hosting in 2024Check out the Free Landing Page Hosting in 2024
Check out the Free Landing Page Hosting in 2024Shubham Pant
 
LESSON 5 GROUP 10 ST. THOMAS AQUINAS.pdf
LESSON 5 GROUP 10 ST. THOMAS AQUINAS.pdfLESSON 5 GROUP 10 ST. THOMAS AQUINAS.pdf
LESSON 5 GROUP 10 ST. THOMAS AQUINAS.pdfmchristianalwyn
 
LESSON 10/ GROUP 10/ ST. THOMAS AQUINASS
LESSON 10/ GROUP 10/ ST. THOMAS AQUINASSLESSON 10/ GROUP 10/ ST. THOMAS AQUINASS
LESSON 10/ GROUP 10/ ST. THOMAS AQUINASSlesteraporado16
 
Introduction to ICANN and Fellowship program by Shreedeep Rayamajhi.pdf
Introduction to ICANN and Fellowship program  by Shreedeep Rayamajhi.pdfIntroduction to ICANN and Fellowship program  by Shreedeep Rayamajhi.pdf
Introduction to ICANN and Fellowship program by Shreedeep Rayamajhi.pdfShreedeep Rayamajhi
 
Bio Medical Waste Management Guideliness 2023 ppt.pptx
Bio Medical Waste Management Guideliness 2023 ppt.pptxBio Medical Waste Management Guideliness 2023 ppt.pptx
Bio Medical Waste Management Guideliness 2023 ppt.pptxnaveenithkrishnan
 
Benefits of doing Internet peering and running an Internet Exchange (IX) pres...
Benefits of doing Internet peering and running an Internet Exchange (IX) pres...Benefits of doing Internet peering and running an Internet Exchange (IX) pres...
Benefits of doing Internet peering and running an Internet Exchange (IX) pres...APNIC
 
Presentation2.pptx - JoyPress Wordpress
Presentation2.pptx -  JoyPress WordpressPresentation2.pptx -  JoyPress Wordpress
Presentation2.pptx - JoyPress Wordpressssuser166378
 
TYPES AND DEFINITION OF ONLINE CRIMES AND HAZARDS
TYPES AND DEFINITION OF ONLINE CRIMES AND HAZARDSTYPES AND DEFINITION OF ONLINE CRIMES AND HAZARDS
TYPES AND DEFINITION OF ONLINE CRIMES AND HAZARDSedrianrheine
 
Vision Forward: Tracing Image Search SEO From Its Roots To AI-Enhanced Horizons
Vision Forward: Tracing Image Search SEO From Its Roots To AI-Enhanced HorizonsVision Forward: Tracing Image Search SEO From Its Roots To AI-Enhanced Horizons
Vision Forward: Tracing Image Search SEO From Its Roots To AI-Enhanced HorizonsRoxana Stingu
 
Zero-day Vulnerabilities
Zero-day VulnerabilitiesZero-day Vulnerabilities
Zero-day Vulnerabilitiesalihassaah1994
 
WordPress by the numbers - Jan Loeffler, CTO WebPros, CloudFest 2024
WordPress by the numbers - Jan Loeffler, CTO WebPros, CloudFest 2024WordPress by the numbers - Jan Loeffler, CTO WebPros, CloudFest 2024
WordPress by the numbers - Jan Loeffler, CTO WebPros, CloudFest 2024Jan Löffler
 

Dernier (12)

Computer 10 Lesson 8: Building a Website
Computer 10 Lesson 8: Building a WebsiteComputer 10 Lesson 8: Building a Website
Computer 10 Lesson 8: Building a Website
 
Check out the Free Landing Page Hosting in 2024
Check out the Free Landing Page Hosting in 2024Check out the Free Landing Page Hosting in 2024
Check out the Free Landing Page Hosting in 2024
 
LESSON 5 GROUP 10 ST. THOMAS AQUINAS.pdf
LESSON 5 GROUP 10 ST. THOMAS AQUINAS.pdfLESSON 5 GROUP 10 ST. THOMAS AQUINAS.pdf
LESSON 5 GROUP 10 ST. THOMAS AQUINAS.pdf
 
LESSON 10/ GROUP 10/ ST. THOMAS AQUINASS
LESSON 10/ GROUP 10/ ST. THOMAS AQUINASSLESSON 10/ GROUP 10/ ST. THOMAS AQUINASS
LESSON 10/ GROUP 10/ ST. THOMAS AQUINASS
 
Introduction to ICANN and Fellowship program by Shreedeep Rayamajhi.pdf
Introduction to ICANN and Fellowship program  by Shreedeep Rayamajhi.pdfIntroduction to ICANN and Fellowship program  by Shreedeep Rayamajhi.pdf
Introduction to ICANN and Fellowship program by Shreedeep Rayamajhi.pdf
 
Bio Medical Waste Management Guideliness 2023 ppt.pptx
Bio Medical Waste Management Guideliness 2023 ppt.pptxBio Medical Waste Management Guideliness 2023 ppt.pptx
Bio Medical Waste Management Guideliness 2023 ppt.pptx
 
Benefits of doing Internet peering and running an Internet Exchange (IX) pres...
Benefits of doing Internet peering and running an Internet Exchange (IX) pres...Benefits of doing Internet peering and running an Internet Exchange (IX) pres...
Benefits of doing Internet peering and running an Internet Exchange (IX) pres...
 
Presentation2.pptx - JoyPress Wordpress
Presentation2.pptx -  JoyPress WordpressPresentation2.pptx -  JoyPress Wordpress
Presentation2.pptx - JoyPress Wordpress
 
TYPES AND DEFINITION OF ONLINE CRIMES AND HAZARDS
TYPES AND DEFINITION OF ONLINE CRIMES AND HAZARDSTYPES AND DEFINITION OF ONLINE CRIMES AND HAZARDS
TYPES AND DEFINITION OF ONLINE CRIMES AND HAZARDS
 
Vision Forward: Tracing Image Search SEO From Its Roots To AI-Enhanced Horizons
Vision Forward: Tracing Image Search SEO From Its Roots To AI-Enhanced HorizonsVision Forward: Tracing Image Search SEO From Its Roots To AI-Enhanced Horizons
Vision Forward: Tracing Image Search SEO From Its Roots To AI-Enhanced Horizons
 
Zero-day Vulnerabilities
Zero-day VulnerabilitiesZero-day Vulnerabilities
Zero-day Vulnerabilities
 
WordPress by the numbers - Jan Loeffler, CTO WebPros, CloudFest 2024
WordPress by the numbers - Jan Loeffler, CTO WebPros, CloudFest 2024WordPress by the numbers - Jan Loeffler, CTO WebPros, CloudFest 2024
WordPress by the numbers - Jan Loeffler, CTO WebPros, CloudFest 2024
 

Application Development - Overview on Android OS

  • 1. Application Development Overview on Android OS Kanak & Pankaj
  • 2. Overview/Design Guidelines • A Mobile Operating System • Uses a modified version of the Linux kernel • Allows developers to write code in java language • Third party application can be built using java and android framework Android 2.1 & Above With Eclipse IDE
  • 5. Layouts & Screen Sizes • FrameLayout Layout that acts as a view frame to display a single object. • LinearLayout A layout that organizes its children into a single horizontal or vertical row. It creates a scrollbar if the length of the window exceeds the length of the screen. • RelativeLayout Enables you to specify the location of child objects relative to each other (child A to the left of child B) or to the parent (aligned to the top of the parent). • ListView Displays a scrolling single column list. Common Layouts
  • 6. • ScrollView A vertically scrolling column of elements. Spinner Displays a single item at a time from a bound list, inside a one-row textbox. Rather like a one-row • TabHost It provides a tab selection list that monitors clicks and enables the application to change the screen whenever a tab is clicked. • TableLayout A tabular layout with an arbitrary number of rows and columns, each cell holding the widget of your choice. The rows resize to fit the largest column. The cell borders are not visible. Layouts & Screen Sizes Common Layouts
  • 7. Layouts & Screen Sizes Screen Sizes Android runs on a variety of devices that offer different screen sizes and densities • xlarge screens are at least 960dp x 720dp • large screens are at least 640dp x 480dp • normal screens are at least 470dp x 320dp • small screens are at least 426dp x 320dp To support multiple screen size • Explicitly declare in the manifest which screen sizes your application supports • Provide different layouts for different screen sizes • Provide different bitmap drawables for different screen densities
  • 8. Layouts & Screen Sizes Screen Sizes Manifest parameters for Screen sizes <supports-screens android:resizeable=["true"| "false"] android:smallScreens=["true" | "false"] android:normalScreens=["true" | "false"] android:largeScreens=["true" | "false"] android:xlargeScreens=["true" | "false"] android:anyDensity=["true" | "false"] android:requiresSmallestWidthDp="integer" android:compatibleWidthLimitDp="integer" android:largestWidthLimitDp="integer"/>
  • 9. Challenges faced while building Naukri App • Installing SDK for different Version of Android • Choosing right IDE for development • Using Spinner to choose value from the dropdown on runtime and from set of array • Calling spinner on clicking ImageView • Choosing right layout to build XML • Optimizing layout and making it re-usable • Saving preferences • Implementing multiple clicks on single activity • Calling multiple activity for result on single activity • Creating complete view on runtime • Finishing activities correctly
  • 10. Setting Up an Activity to set background image and music Background can contain image as well as music. Their time out can be handled using simple threads in java. Permissions Required – <uses-permission android:name="android.permission.SET_WALLPAPER"></uses- permission> Setting up the Content View – protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.amazing); } Introduction to Media Player and Sound Pool – MediaPlayer theSong = MediaPlayer.create(this, R.raw.uninvited); theSong.start(); theSong.release();
  • 11. Setting Up an Activity to set background image and music On pause Activity – @Override protected void onPause() { // TODO Auto-generated method stub super.onPause(); //theSong.stop(); // ---- this is same as Mediaplayer.release() the only differnece is release method releases the other objects related to it and stop method abruptly stops the object theSong.release(); finish(); }
  • 12. Creating a LIST/MENU and referencing the selected Item Extending ListActivity instead of Activity Setting List – ArrayAdapter<String> adapter = new ArrayAdapter<String>(MenuApp.this, android.R.layout.simple_list_item_1, classes); setListAdapter(adapter); OnListItemClick() Setting MenuKey – MenuInflater blowUp = getMenuInflater(); blowUp.inflate(R.menu.cool_menu, menu); OnOptionsItemSelected()
  • 13. Setting Up buttons and text views Button add = (Button) findViewById(R.id.bAdd); Button sub = (Button) findViewById(R.id.bSub); TextView display = (TextView) findViewById(R.id.tvDisplay); Setting onClickListeners() for button clicks – add.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub counter++; display.setText("Your Total is: " + counter); //display.setText(Integer.toString(counter)); } });
  • 14. Setting Up buttons and text views sub.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub counter--; display.setText("Your total is : " + counter); } });
  • 15. SETTING UP A FORM WITH EDITBOXES AND TOGGLE BUTTON AND SIMPLE BUTTONS final ToggleButton passTog = (ToggleButton) findViewById(R.id.tbPassword); final EditText Name = (EditText) findViewById(R.id.etName); final EditText MobNum = (EditText) findViewById(R.id.etMobileNumber); final EditText EmailId = (EditText) findViewById(R.id.etEmailID); final EditText Password = (EditText) findViewById(R.id.etPassword);
  • 16. SETTING UP A FORM WITH EDITBOXES AND TOGGLE BUTTON AND SIMPLE BUTTONS Setting the input type for password field on the basis of toggle button- passTog.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub if(passTog.isChecked()){ Password.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); }else{ Password.setInputType(InputType.TYPE_CLASS_TEXT); } } });
  • 17. SETTING UP A FORM WITH EDITBOXES AND TOGGLE BUTTON AND SIMPLE BUTTONS Setting Alert Boxes – new AlertDialog.Builder(TextActs.this) .setMessage("Please fill in the valid email address, mobile number and password should be minimum 6 characters long") .setTitle("Validation Error") .setCancelable(true) .setNeutralButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton){} }) .show();
  • 18. SENDING AN EMAIL FROM APPLICATION Permission Required – <uses-permission android:name="android.permission.INTERNET"></uses-permission> Setting Up Email intent – String emailaddress[] = { emailAdd }; String message = “Some MEssage"; Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, emailaddress); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "I hate you!"); emailIntent.setType("plain/text"); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, message); startActivity(emailIntent);
  • 19. SAVING PREFERENCES Preferences in Androids are like cookies on browsers which are saved in the phone memory and can be accessed any time during the application. <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <EditTextPreference android:title="Edit Text”android:key="name" android:summary="Enter your name” /> <CheckBoxPreference android:title="Music” android:defaultValue="true" android:key="checkbox” android:summary="for the start screen"> </CheckBoxPreference> <ListPreference android:title="list” android:key="list” android:summary="Choose from” android:entries="@array/list” android:entryValues="@array/lValues" ></ListPreference> </PreferenceScreen>