Upload
hakeem-campbell
View
36
Download
2
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
DEVELOPING ANDROID APPLICATION BY
PANKAJ SARANGI11MTESD01
GUIDE-MAHENDRA K.R. CHOUDHURY
SUIITEMBEDDED SYSTEM DESIGN
POINTS OF DISCUSSION
About AndroidDevelopment EnvironmentConcepts for android developmentDesign of the projectConclusionFuture scopeReferences
ABOUT ANDROID
• 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
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
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
ECOSYSTEM OF ANDROID
ANDROID VERSIONS
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?
BUILDING BLOCKS OF ANDROID
WHAT IS ACTIVITY
WHAT IS INTENT
A description on what is to be done
WHAT IS SERVICE
Back ground job that has no pause or stopped stage
CONTENT PROVIDER
A barrier between the application and the database so that the data base is not in inconsistent state
WHAT IS BROADCAST RECEIVER
Alert messages like battery low etc
WHY ANDROID IS BETTER ?
• Applications - google applications -widgets -Android Market • Multitasking
• SDK • Modifiability:
D
EVELOPMENT
ENVIRONMENT
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
ECLIPSE
C
DDMS
ANDROID EMULATOR
CONCEPT FOR
ANDROID
DEVELOPMENT
FILES THAT MAKES AN ANDROID APP
•Src•Gen•Res drawable layout values string menifest
LAYOUT
MENIFEST FILE
<?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
VALUES
DRAWABLES
SUPPORTING DIFFERENT SCREEN
LAYOUTS
LINEAR LAYOUT (VERTICAL)
LINEAR LAYOUT (HORIZONTAL)
RELATIVE LAYOUT
INTENT
NOTIFICATION
MEDIA PLAYER
VIDEO PLAYER
BEHIND THE SCREEN
DESIGN OF
PROJECT
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
JAVA FILES
•MainActivity.java, •ExpenseActivity.java, •ExpenseItemActivity.java,•ExpenseBR.java, •TimeZoneChangeBR.java, •IntentActivity.java•Media.java, •Video.java,•Notifications.java, •NotificationClickedActivity.java
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
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
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
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
•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
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.
•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
•
•
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
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
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);
•By the below methods we can be able to see the videos vv.setVideoURI(uripath); vv.setMediaController(new MediaController(this)); vv.requestFocus(); vv.start();
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
CONCLUSION
FUTURE
SCOPE
•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