Diese Präsentation wurde erfolgreich gemeldet.
Die SlideShare-Präsentation wird heruntergeladen. ×

Application Development - Overview on Android OS

Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Nächste SlideShare
Android Development
Android Development
Wird geladen in …3
×

Hier ansehen

1 von 20 Anzeige
Anzeige

Weitere Verwandte Inhalte

Diashows für Sie (20)

Ähnlich wie Application Development - Overview on Android OS (20)

Anzeige

Aktuellste (20)

Application Development - Overview on Android OS

  1. 1. Application Development Overview on Android OS Kanak & Pankaj
  2. 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
  3. 3. Overview/Design Guidelines What's in an App
  4. 4. Starting with the Project
  5. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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>
  20. 20. Questions/Comments ?

×