70
DEVELOPING ANDROID APPLICATION BY PANKAJ SARANGI 11MTESD01 GUIDE-MAHENDRA K.R. CHOUDHURY SUIIT EMBEDDED SYSTEM DESIGN

Points of discussion

Embed Size (px)

DESCRIPTION

Developing android application by pankaj sarangi 11mtesd01 guide- mahendra k.r . choudhury SUIIT EMBEDDED SYSTEM DESIGN. About Android Development Environment Concepts for android development Design of the project Conclusion Future scope References. Points of discussion. - PowerPoint PPT Presentation

Citation preview

Page 1: Points of discussion

DEVELOPING ANDROID APPLICATION BY

PANKAJ SARANGI11MTESD01

GUIDE-MAHENDRA K.R. CHOUDHURY

SUIITEMBEDDED SYSTEM DESIGN

Page 2: Points of discussion

POINTS OF DISCUSSION

About AndroidDevelopment EnvironmentConcepts for android developmentDesign of the projectConclusionFuture scopeReferences

Page 3: Points of discussion

ABOUT ANDROID

Page 4: Points of discussion

• The aim of this project is to design an application named as “Traveler Assistant” which helps user to keep a track of the expenses made during their travel and do a little other stuff.

• Before going to develop the actual development we should know what are the prerequsite for developing the application

Page 5: Points of discussion

Windows Mobile

Symbian Blackberry Iphone Android

Promoted by Microsoft Nokia RIM Apple Google and OHA

Platform proprietary Now open source

proprietary proprietary Open Source

Development Require Windows

Any platform Any platform Mac Open Source

Development Tools

C++, .net,J2ME,HTML,CSS

C,c++,J2ME, HTML,css,javaScript,J2ME

Objective c Java,xml

Leading Companies

Acer, HTC, Samsung, HP

Nokia, SamsungSony

RIM apple Samsung,HTC,

DIFFERENT OPERATING SYSTEM

Page 6: Points of discussion

Andy RubbinCo-founder of Android INCSVP, Mobile and Digital ContentGoogle INC1. Android is a open software platform for mobile

application development.2. Android is a complete stack which includes operating

system, middleware and application. The operating system is powered by Linux and the application development is done using java

Page 7: Points of discussion

ECOSYSTEM OF ANDROID

Page 8: Points of discussion

ANDROID VERSIONS

Page 9: Points of discussion

BASIC QUESTIONS ON ANDROID1. What are various building blocks of android app?2. What is the life cycle of android app?3. How does a app handles hardware events?4. How does an app runs background jobs?5. How to access the database?

Page 10: Points of discussion

BUILDING BLOCKS OF ANDROID

Page 11: Points of discussion

WHAT IS ACTIVITY

Page 12: Points of discussion

WHAT IS INTENT

A description on what is to be done

Page 13: Points of discussion

WHAT IS SERVICE

Back ground job that has no pause or stopped stage

Page 14: Points of discussion

CONTENT PROVIDER

A barrier between the application and the database so that the data base is not in inconsistent state

Page 15: Points of discussion

WHAT IS BROADCAST RECEIVER

Alert messages like battery low etc

Page 16: Points of discussion
Page 17: Points of discussion

WHY ANDROID IS BETTER ?

  

• Applications   - google applications   -widgets  -Android Market  • Multitasking

• SDK • Modifiability: 

  

Page 18: Points of discussion
Page 19: Points of discussion

D

EVELOPMENT

ENVIRONMENT

Page 20: Points of discussion

Software necessary for Android development are

• Java runtime environment(JRE)

• Eclipse IDE

• Android Software Development Kit(SDK)

• Android development plug-in tools(ADT)

• Android Virtual Device(AVD) or Emulator

Page 21: Points of discussion

ECLIPSE

C

Page 22: Points of discussion
Page 23: Points of discussion

DDMS

Page 24: Points of discussion
Page 25: Points of discussion

ANDROID EMULATOR

Page 26: Points of discussion
Page 27: Points of discussion

CONCEPT FOR

ANDROID

DEVELOPMENT

Page 28: Points of discussion
Page 29: Points of discussion

FILES THAT MAKES AN ANDROID APP

•Src•Gen•Res drawable layout values string menifest

Page 30: Points of discussion

LAYOUT

Page 31: Points of discussion

MENIFEST FILE

Page 32: Points of discussion

<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android=http://schemas.android.com/apk/res/android //start package="com.pankaj.pankajdrawables“ //package //android name space decoration android:versionCode="1“ //used by the store android:versionName="1.0" >

<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="14" /> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name“ //nmame android:theme="@style/AppTheme" > <activity //activity android:name="com.pankaj.pankajdrawables.MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application>

</manifest> //end

Page 33: Points of discussion

VALUES

Page 34: Points of discussion

DRAWABLES

Page 35: Points of discussion

SUPPORTING DIFFERENT SCREEN

Page 36: Points of discussion

LAYOUTS

Page 37: Points of discussion

LINEAR LAYOUT (VERTICAL)

Page 38: Points of discussion

LINEAR LAYOUT (HORIZONTAL)

Page 39: Points of discussion

RELATIVE LAYOUT

Page 40: Points of discussion

INTENT

Page 41: Points of discussion

NOTIFICATION

Page 42: Points of discussion
Page 43: Points of discussion

MEDIA PLAYER

Page 44: Points of discussion

VIDEO PLAYER

Page 45: Points of discussion

BEHIND THE SCREEN

Page 46: Points of discussion

DESIGN OF

PROJECT

Page 47: Points of discussion

The blue print of my project is given below

Expense activity

Traveler Assistant main

screen

Expense item activity

Alert dialogue

video

Notification

Audio

Face book and dial

Broadcast receiver

Page 48: Points of discussion

JAVA FILES

•MainActivity.java, •ExpenseActivity.java, •ExpenseItemActivity.java,•ExpenseBR.java, •TimeZoneChangeBR.java, •IntentActivity.java•Media.java, •Video.java,•Notifications.java, •NotificationClickedActivity.java

Page 49: Points of discussion

XML FILES

•activity_main.xml•expenselayout.xml•addexpenselayout.xml•intent_activity.xml•audioplayer.xml•video.xml•activity_notifications.xml•after_notification_is_clicked.xml•strings.xml•AndroidManifest.xml

Page 50: Points of discussion

DESIGNING THE MAIN SCREEN• A xml layout file activity_main.xml was created where there are two buttons named as login button and cancel button, two text views named as user id and password and two edit text where we can write into.• Then a class is to be declared as MainActivity.java with an interface onClick where we can write the code. •The xml file is linked to the code by R.layout.xml • The reference to the objects on the UI are created by findViewById.•Then we have to set the listener by the method setOnClickListener•After this we have to implement the interface .inside interface implementation we have to display some message by the method Toast.makeText•After running this application in eclipse we can see some text are displayed when the button is clicked

Page 51: Points of discussion
Page 52: Points of discussion

ADDING MENU ITEMS TO THE MAIN SCREEN

•To the MainActivity.java we have to add some code so that on clicking on the menu button of the phone we will be able to see the menu.•I have added six menu items to the screen they are Expense,audio,video,Notification,preferences,facebook•Though we can create menu using xml I have created it using API so there is no need for xml layout file•So adding a method onCreateOptionsMenu I have created the menu items•Then by another method onOptionsItemSelected we can do what we want to do with the menu

Page 53: Points of discussion
Page 54: Points of discussion

DEVELOPING THE EXPENSE MENU•First we have to modify the MainActivity.java so that we will be able to redirected to a new screen when expense menu is clicked. this is done by creating an intent object. Then by intent creation we can be able to move to a new activity. Thanks to myIntent= new Intent(getBaseContext(),ExpenseActivity.class);startActivity(myIntent);In ExpenseActivity we have to add an xml file expenselayout.xml and link it to the class.From this class we have to start a new class so we have to add an intent. Now on clicking addexpense button we will be taken to another screen so we have to create another class ExpenseItemActivity.java

Page 55: Points of discussion

•In ExpenseItemActivity we have to link an xml file addexpenselayout.xml and giving reference to object and setting the listener .•Then implementing the interface we can be able to do what we want to do with the buttons.•Now we have to add some alert message on clicking of the buttonBy the method protected Dialog onCreateDialog(int id). Inside this we have to set the icon ,title .•Finally we have to add these newly created activity in the menifest file.•On running the application on the emulator we will see the following output

Page 56: Points of discussion
Page 57: Points of discussion

DESIGNING THE FACE BOOK MENU•Now when the user clicks on face book menu he ll be taken to the new screen where he can dial an emergency number or browse face book•We have to first modify the MainActivity.java so that we can go to a new screen•Then we have to create a new layout file such that it will display two buttons to the user one for face book and other for dial named as intent_activity.xml.•Again we have to create a new class IntentActivity.java where the above xml file is linked. and the reference to the object are set ,onclick listener is set•Then we have to implement the interface in such a way that we can go to another page on clicking the button. this is done by again using an intent.•We have to include the newly created class to the menifest file.

Page 58: Points of discussion

•For the icon we have to copy an image in png format and paste it inside the draw-able folder•Then we have to modify the String.xml to some extent.•The output is shown below

Page 59: Points of discussion

ADDING BROADCAST•Then we are going for adding some broadcast receiver which we can see in Logcat of DDms•For this we have to declare the two classes for two broadcast receiverExpenseBR.java and TimeZoneChangeBR.java.•we have to include these two classes to menifest file•Here only difference with the class is that its super class is Broadcast receiver.•Inside the classes by the method public void onReceive(Context context, Intent intent) and a Log.v we will be able to see the broadcast in the logcat process

Page 60: Points of discussion

ADDING THE MEDIA PLAYER•On click of the media the UI will be shown and on click of play the music will start playing•For this we have to modify the case statement of main activity as to move to a new UI•we have to add music file which are in .mp3 format and the name is in lowercase in the newly created ‘raw’ file.•We have to add a xml file which will show the user the option to start and stop the music•After this we have to create a new class media.java .•Inside the class we have to declare MediaPlayer mp, give the references to the button play and stop,setting the listner method.•By the methods mp.prepare(),mp.start(),mp.stop() we can able to listen the music

Page 61: Points of discussion
Page 62: Points of discussion

ADDING THE VIDEO PLAYER

•Here we are going to add some more entertainment for the user by adding some videos. On clicking on the video menu he ll be taken to another activity where he can see a video•For this we have to add a .mp4 file to the “raw” folder and then we are going to add an xml for video view the layout is quiet different.•Then we are going to add a Video class where the above xml file will be linked•We will add the video by defining a Uri and parsing it to Uri.parse("android.resource://"+getPackageName().toString()+"/"+R.raw.raju);

Page 63: Points of discussion

•By the below methods we can be able to see the videos vv.setVideoURI(uripath); vv.setMediaController(new MediaController(this)); vv.requestFocus(); vv.start();

Page 64: Points of discussion

WARNING MENUAfter this we will try to add some warning when the user will click on warning menu he will be taken to a page where when he clicks on the button some notification will be shown on top of the phone on clicking the notification he ll be shown a warning messageFor this we have to change the main activity as to go to the warning screenthen by adding the xml file activity_notification.xml where the user clicks the buttonafter this we have to link this xml file to the newly created class Notifications.javaThen we have to create a a new class NotificationClickedActivity and here we will link the xml file after_notification_is_clicked.xml We will add these activities to the menifest and run the program we ll be able to see the warning message

Page 65: Points of discussion
Page 66: Points of discussion

CONCLUSION

Page 67: Points of discussion
Page 68: Points of discussion

FUTURE

SCOPE

Page 69: Points of discussion

•A database can be embedded into the application•Some google services like google map can be added•We can publish our app in google play store

Page 70: Points of discussion

THANK YOU

[email protected]@gmail.com