Hndout on Governance by Mr. Atish Mathur iasFull description
scjpFull description
rrrDeskripsi lengkap
lifletDeskripsi lengkap
meter regulating stationDeskripsi lengkap
1Full description
Description complète
Mr
b
Full description
Deskripsi lengkap
yt6uyoliu;
Full description
tamilFull description
novel
MR-AR 1,2 &3Full description
MR D7FDescription complète
Pumps SystemDescripción completa
DURGA SOFT SOLUTIONS
ANDROID
By Mr. Mahesh
Durga Soft Solutions , SR Nagar , Hyderabad . www.durgasoft.com
1
ANDROID: What is Android?
Android Is a mobile Operating System developed by Google.
Android Os is based on open Linux kernal.
Unlike iPhone Os, Android Os is Open source, meaning the developers can modify and customize the os for each phone. phone.
Developers can create programs for Android by using the the Android SDK(Software Development Kit).
Android programs are written in java and run through Goo gle’s Davlik virtual machine, which optimized for mobile devices.
Android Architecture Architecture :
The Main Components in the Android Architecture are 1. Android Application 2. Application Framework 3. Libraries(Core & Native) 4. Runtime Android (DVM- Dalvik Virtual Machine) 5. Kernel – Linux By Mr. Mahesh
Durga Soft Solutions , SR Nagar , Hyderabad . www.durgasoft.com
2
1. Android Applications: Applications:
These are applications written in Java. Some of basic applications includes an calendar, email client, SMS program, maps, making phone calls, accessing the Web browser, accessing your contacts list and others. o thers. 2. Application FrameWork: FrameWork:
This is the skeleton or framework which all android developers has developers has to follow. The developers can access all framework APIs an manage phone’s basic functions like resource
allocation, switching between between processes or programs, programs, telephone applications, applications, and keeping track track of the phone’s physical location. 3.
Libraries:
a. Core Libraries: The Android Android runtime layer layer which includes set of core java libraries libraries and DVM (Dalvik Virtual Machine) is also located in same layer. b. Native Libraries: This layer consists of Android libraries written in C, C++, and used by various system. These libraries libraries tells the device how to handle different kinds kinds of data and are exposed to Android developers via Android Application framework. Some of these libraries includes media , graphics, 3d,SQLite,web 3d,SQLite,web browser library etc. 4. Runtime Android (Dalvik virtual Machine):
This layer includes set of base libraries libraries that are required for java java libraries. Every Android application gets its own instance of Dalvik virtual machine. Dalvik has been written so that a device can run multiple VMs efficiently and it executes files in executable (.Dex) optimized for minimum memory. 5. Kernel – Linux:
This layer includes Android’s memory management programs, security settings, power management software and several drivers for hardware , file system access, networking and interprocess-communication. process-communication. The kernel also acts as an abstraction layer between hardware and the rest of the software stack.
By Mr. Mahesh
Durga Soft Solutions , SR Nagar , Hyderabad . www.durgasoft.com
3
Android Versions:
Android 1.0 (API level 1) of Android is 1.5 (CupCake) may Android 2.3.3 –2.3.7 Gingerbread (API level 10) First Major version of version (CupCake) may 2009
Android 2.14.0(ice Eclair (API level 7)Sandwitch) Android Cream S andwitch)
Android 4.1 Jelly Bean (API level 16)
Android 2.2 –2.2.3 Froyo (API level 8)
Android 4.2 Jelly Bean (API level 17)
Android 2.3 –2.3.2 Gingerbread (API level 9)
Android 4.3 Jelly Bean (API level 18)
Android 2.3.3 –2.3.7 Gingerbread (API level 10)
Android 4.4 KitKat (API level 19)
Android 3.0 Honeycomb (API level 11)
Android Android Features:
The following are the advantages of Android
Application Application framework enabling reuse and replacement of components
Dalvik virtual Dalvik virtual machine optimized for mobile devices
Optimized graphics
SQLite for structured data storage stora ge
Media support for common audio, video, and still image formats (MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, GIF)
GSM Telephony (hardware dependent),Bluetooth, EDGE, 3G, and WiFi (hardware dependent),Camera, dependent),Camera, GPS, compass, and accelerometer (hardware dependent)
Rich development environment To Create , Test and build Android applications we need the following Softwares:
1. Eclipse IDE (is optional can use any other tool. But Eclipse is recommended ) + added with Android Development plugin 2. Android SDK(Software Development Kit we can download download these s/w from from this site By Mr. Mahesh
http://www.android.com
Durga Soft Solutions , SR Nagar , Hyderabad . www.durgasoft.com
4
Required Softwares:
o n any OS such as Windows, Linux, and MAC Os The android app can be developed on The following are the resources that are required to set up into the system for
android
application development 1. An IDE (Integrated Development Environment) : The Eclipse is the most prefered IDE. We can download the Eclipse IDE from the following website.
http://www.eclipse.org
2. Add a plugin making the eclipse aware of Android. The Android Development Tool(ADT) is the Eclipse plugin doing this. For this we want to use the Install plugin option of the Eclipse IDE. Alternatively we can get the ADT zip file downloaded from
http://www.android.com http://www.android.com and
manually copy the features and plugins folders into the eclipse root folder , which we got extracting the ADT zip file. 3. In addition to the IDE and its plugin simplifying creating the android applications we want to have an android SDK for building, and testing the android applications, we can download the SDK from http://www.android.com http://www.android.com After extracting the downloaded zip file for the SDK we need to run the ‘SDK Manager’ whicj is found in the this find &
install various available packages. The Android Application:
The Android Application is basically composed of the following 3 type of components. 1. Activity 2. Service 3. BroadCast Receiver
By Mr. Mahesh
Durga Soft Solutions , SR Nagar , Hyderabad . www.durgasoft.com
5
Activity:
The Activity is the one of the core components of Android App
This is crated as a Java Object subtype ofandroid.app.Activity
This component is managed by the Android App Framework
The Following are the possible methods that we can override the Activity Object.
The onCreate() :
The onCreate() methos is used to implement initialization code like presenting the View for the Activity. The onStart():
The onStart() method allows writing the code executing on getting the activity foreground The onRestart() :
The onRestart() method can initialize the resources that are closed in the onStop(). The onStop() :
The onStop() method can use the resources that are not required on paused activity. This may even required to solve the start of the activity. The onResume() :
The onResume() can create the resources and / or get the saved state of the activity to get into foreground. The onDestroy() : The onDestroy() can perform the finilizations for the activity.
By Mr. Mahesh
Durga Soft Solutions , SR Nagar , Hyderabad . www.durgasoft.com
6
The Life Cycle of Activity is:
Or Creating an Activity:
While creating/starting the activity the following methods are invoked. onCreate() onStart() onResume()
Some other Activity wants to come to ForeGround: At this stage ‘onPause()’ of this activity is invoked and then the other activity is started. In case of the other activity is taking the complete screen the ‘onScreen()’ is invoked getting the activity to background(stopped). Otherwise it gets paused.
By Mr. Mahesh
Durga Soft Solutions , SR Nagar , Hyderabad . www.durgasoft.com
7
The Activity is getting into the ‘foreground’:
This activity which is paused or stopped because of some other activity is foreground, is now coming foreground because of the existing foreground activity is destroyed. At this stage the ‘onResume()’ is the only method invoked in case of getting from paused. If it was stopped the following methods are invoked. onRestart() onStart() onResume()
The Activity Destroying:
The Activity while destroying from foreground invokes the following methods. onPause() onStop() onDestroy()
Point to Note : The android system can destroy the stopped activity without a user request, just
invoking ‘onDestroy()’
The Startup Application :
For the first time want to take the following points to check
Install with Android SDK with necessary APIs
Create a ‘AVD(Android Virtual Device)’, we can do this using ‘SDK Manager’ which
you find in the Android SDK installed.
Eclipse is installed with ADT Plugin, and for the first time we want to set the Android SDK location in Eclipse-window- Preferences.
Select ‘Android’ from the left side tree.
Browse the Android SDK Install Folder
Eg: d:\android\SDK-windows
By Mr. Mahesh
Durga Soft Solutions , SR Nagar , Hyderabad . www.durgasoft.com
8
Once Creating the Android project we find the project is created with one activity bydefault. The following are the few important documents or folders to observe. When you create a new Android project, you get several items in the project's root directory:
src
A folder that holds the Java source code
gen
This is where Android's build tools will place source code that they generate. R.java" is a generated class which contains the text and the UI elements. Android projects come with this free class 'R' which is short for Resource. This is an automatically generated class that we can use to reference resources in our project. We should not try to modify this class manually.
assets
A folder that holds other static files you wish packaged with the application for deployment onto the device.
bin
In Eclipse, the ADT plugin incrementally builds our project as we make changes to the source code. Eclipse outputs an .apk file automatically to the bin folder of the project, so we do not have to do anything extra to generate the .apk.
res
A folder that holds resources such as icons, graphic user interface (GUI) layouts, etc. that are packaged with the compiled Java in the application.
AndroidMainFest.xml
An XML file describing the application being built and which components (activities, services, and so on) are being supplied by the application. This file is the foundation for any Android application. This is where you declare what is inside your application. You also indicate how these pieces attach themselves to the overall Android systems; for example, you can indicate which activity or activities should appear on the device's main menu (a.k.a. the launcher). When you create your application, a starter manifest will be generated for you automatically. For a simple application, offering a single activity and nothing else, the auto generated manifest will probably work out fine, or perhaps require a few minor modifications. But on the other spectrum, the manifest file for the Android API demo suite is more that 1,000 lines long. Your production applications will probably falls somewhere in the middle. Most of the manifest will be describes detail in later chapters.
By Mr. Mahesh
project.properties Durga Soft Solutions , SR Nagar , Hyderabad www.durgasoft.com Property files used by. the Ant build script.
9
Creating an Activity:
The activity class needs to be a subtype of android.app.Activity
The onCreate() method is one basic method which minimum we want to override . Like we may want to create / locate the View and set it to the Activity. The following methods of Activity are used to set the View o
setContentView(View)
o
setContentView(int)
The first allows to set the View Object may be creat ed in the program here. And the later allows setting the view defined in the XML document. The FirstActivity.java :
public class FirstActivity extends Activity { /** Called when the activity is first created. */
OUT PUT SCREEN
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Code without main.xml /* TextView tv=new TextView(this); tv.setText("Hello from FirstActivity"); setContentView(tv); */ // Code with main.xml setContentView(R.layout.main); } } By Mr. Mahesh
Durga Soft Solutions , SR Nagar , Hyderabad . www.durgasoft.com
10
Main.xml:
The android application includes a generated resource file named ‘R’ which lists all the resources
defined with unique identity. And this xml View is also given with a unique id to refer in the program. The id can be accessed using ‘R.layout.Main’.
Thus the activity can have this View set as shown below
public class FirstActivity extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); }
It is found in most cases creating a complex view it is convenient to go for XML style How ever we can get View created in xml into the activity and do necessary changes .
Durga Soft Solutions , SR Nagar , Hyderabad . www.durgasoft.com
11
To run the above code could give an error as in the main.xml file the TextView is not specified with any id. To run this above code successfully add the following attribute into the Tag. andrioid:id=”@+id/tv1”
The ‘+’ in the value of the attribute describes add the is resource into the ‘R’ file if
not available The android application support multiple type of resource such as layouts, ids and Strings
The String resource is can be added into ‘strings.xml’ file res/values folder
Eg: Text String M essage
These resources are added into the R file for convenient access.
To access the resources in ‘xml’ documents we use the following syntax.
Syntax: Eg:
@/ @String/test
In case the same is required to access in the program we use. R.. We can use the following method for getting the string resource declared in the xml. String s1=getResources().getString(R.String.test); Similar to String we can have a Boolean resource .this is declared using tag. Starting an Activity:
The activity with ACTION_MAIN, and CATEGORY_LAUNCHER is main activity to run on accessing the application. In addition we may want to start another activity from such main activity. We use startActivity(Intent) method of the Activity to do this.
The Intent Object:
The Intent is a value object describing a message to the android system to perform an action. Like we may want to describe the android system to start an activity or background service The Intent Object describes following six methods 1. Component Name 2. Action 3. Categories
By Mr. Mahesh
4. 5. 6.
Data Extras Flags
Durga Soft Solutions , SR Nagar , Hyderabad . www.durgasoft.com
12
The Intents are of two types. 1. Explicit Intents 2. Implicit Intents
Explicit Intents:
These type of intents are started with component name, which directly locates a Activity by its name. Example: Lets add a new activity in the previous class Public class Activity2 extends Activity { Public void onCreate(Bundle b) { super.onCreate(b); setContentView(R.layout.main1.xml); } } This new Activity is requited to register into the AndroidManifest.xml
In the existing Activity: Lets consider the main.xml is the layout document and has the following tag.
Android:onClick=”myMethod”/> The following method needs to added into the existence Activity public void myMethod(View view) { Intent i=new Intent(); i.setComponentName(new ComponentName(getApplicationContext(),Activity2.class)); startActivity(i); } By Mr. Mahesh
Durga Soft Solutions , SR Nagar , Hyderabad . www.durgasoft.com
13
Implicit Intents:
Although the explicit intents are simple but are useful only to locate the activities whose names are known to us, which is generally with the activities of our application. In case if we want to access the activities of some other applications in the system explicit would not meet our requirement In this case the android system is responsible to find the suitable activities to handle this intent. In case if none found the ActivityNotFoundException would be thrown. To do this the intent object is matched with the configured intent filter f or the activities .The following tag is used in the tag to configure the intent filter. ........................> Implicit Intent:
In Case if the Intent without a component is given , the f/w needs to use the package manager conduct the following 3 tests to find the suitable activities that can handle this intent. o
Action:
o
Data:
o
Here the intent action is match with the actions of the intent filters of the activities. If the intent doesn’t has an action(ies it is null) in such case every activity with an intent filter atleast with one action will passes this test. Android includes multiple builtin actions such as ACTION_CALL We can create our own action, It is recommended to use package name as prefix for the action name. For example com.durgasoft.android.GAME_START Once if the activity passes the action test then it is checked for data test. Here the MIME type and / or path is matched to find is the activity matching to handle the intent with the given data.
Category:
The intent and intent filter can have multiple categories added. All the categories describes in the intent should match the intent filter categories passing this test.
Note:
The category ‘android.intent.category.DEFAULT’ is mandatory to include into the intent filter to have any implicit intents locating this activity. This is excempttion for LAUNCHER activity.
By Mr. Mahesh
Durga Soft Solutions , SR Nagar , Hyderabad . www.durgasoft.com
14
Intent and Intent Filters:
The intent filters for an activity are declared in the android manifest.xml file as part of configuring the activity. The can have , and
Note:
Having at least one is mandatory to choose this activity using implicit intent Having the with the namae android.intent.category.DEFAULT is also mandatory for locating using implicit intents. Example for the LAUNCHER and ALTERNATIVE category intent. The implicit intents requires to identify the appropriate activity to handle the intent. To do this it matches the intent info(such as action, type, data, and category) with the intent filters info of the activity. If the intent info matches with the intent filter info then the enclosing activity is chosen to handle this intent Example
Intent i=new Intent(); i.setAction(Intent.ACTION_DIAL); startActivity(i); This starts a phone dialer activity allowing us to dial the number and make a call.
In addition to ‘startActivity()’ we can use the ‘startActivityForResult()’ method to
The ‘start ActivityForResult ()’ method is used to start an activity that can carry
start an activity. some data returning to the parent activity. This method takes 2 arguments.
First Arg: Intent Second Arg: int(specifies the request code, this is used diffentiate between the multiple child activities that are possible to start from the activity)
This code is used in ‘onActivityResult()’ method to find the result from which child
activity. The child Activity can use the following method for sending the result. setResult(int resultcode,Intent data)
Once the childActivity is finished then the following method of the parent activity is invoked. onActivityResult(int requestcode,int resultcode,Intent data)
Note:
In Case if the child activity finished without setting the result , the data will be null. Sample Program on Intents: SecondActiivity.java:
package com.durgasoft.android; import com.durgasoft.android.R; import .................................................................; public class SecondActivity extends Activity { /** Called when the activity is first created. */ @Override
By Mr. Mahesh
Durga Soft Solutions , SR Nagar , Hyderabad . www.durgasoft.com
16
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } // Code for explicit Intents public void MyMethod(View view) { Intent i=new Intent(); // Register the Activity2 class in the android manifest.xml file inside tag //
package com.durgasoft.android; import --------------------------------------------; public class Activity2 extends Activity {
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main1); } } By Mr. Mahesh
Durga Soft Solutions , SR Nagar , Hyderabad . www.durgasoft.com
17
Main.xml
Main1.xml
By Mr. Mahesh
Durga Soft Solutions , SR Nagar , Hyderabad . www.durgasoft.com
18
AndroidManifest.xml
Understanding the Views:
The Userinterface of an activity is defined using a View Object. The View group is one special View type that allows us compose multiple View’s into a single view, thus we can have multiple views to present in a single screen (ies a single View). The following method of an Activity is used to set the View for this Activity. setContentView(android.View.View) setContentView(int ViewID)
The View can be described in two styles. o Into XML declarative o In Activity( Java Code) programmatic. We can use both in combination.
It is recommended use XML style , which can simplify creating the View and allows take the advantage of first design using click and drag supported by the IDE.
By Mr. Mahesh
Durga Soft Solutions , SR Nagar , Hyderabad . www.durgasoft.com
19
Usign XML Style:
In this case we create an XML documents into res/layouts folder
An XML document can describe only one View. Note the View here can be a View group thus a tree of Views Here we have an XML tag one for each concrete View type t o use defining the View. Example:
Example:
By Mr. Mahesh
Durga Soft Solutions , SR Nagar , Hyderabad . www.durgasoft.com
43
Dialog Box:
The android.app.DialogInterface is the base interface representing any dialog. The android.app.Dialog class supports declaring a dialog . This is the base class for any dialog.
Example:
Dialog d=new Dialog(this); d.setContentView(R.layout.dialog_layout); The dialog_layout describes the view for the dialog just as done for the activity. d.setOwnerActivity(MyActivity,this); d.show(); // This will show the dialog we can add onCancelListener and onDismissListener’s set to the Dialog.
We use any of the following methods of Dialog to choose the dialog box. Cancel(); Dismiss(); Android includes the following builtin dialogs implementation simplifying creating the dialog box for most common requirements. Alert Dialog ProgressBar Dialog DatePicker Dialog TimePicker Dialog
The AlertDialog: This supports us to create a dialog that meets the most common requirement of having a dialog for showing some alert, this includes
-
A Optional Title Message Text Zero, one, two, or three buttons List of items
By Mr. Mahesh
Durga Soft Solutions , SR Nagar , Hyderabad . www.durgasoft.com
44
We use a ‘AlertDialog.Builder’ object to crate this Dialog .
The following methods of this object allows us setting the details for the dialog. -
Once setting all the details , we can invoke create() method for the AlertDialog object and further show() method for showing. The following methods of Activity can be used to show and remove the Dialog boxes.
showDialog(int): This shows the Dialog. removeDialog(int): Removes the dialog from the Activity The OnCreateDialog(int): method is invoked for the first time
when a dialog is requested to show. This method is responsible to create a dialog for the given index to show. The onPrepareDialog(int): method is invoked each time(including firsttime) when a dialog is required to show.
Note:
The Activity retains the state of the dialog even on cancelled / dismiss of the dialog is requested to show again . However invoking remove Dialog(int) will release the dialog state with the activity.
The Menu: The following methods ‘Activity ‘ are invoked to create the
menu for the activity. OnCreateOptionsMenu(menu):
This method is invoked for the first time the user clicks on the menu for the activity. Note: From Android 3.0 this is invoked at the time starting the Activity as the menu here is always visible.
By Mr. Mahesh
Durga Soft Solutions , SR Nagar , Hyderabad . www.durgasoft.com
45
OnPrepareOptionsMenu(menu):
This is called each time when the menu is required to be show. To Listen for the menu item click we can override the following method. boolean onMenuItemSelected(int featureId,MenuItem m)
Sample Program on Dialog Boxes and Menu’’s:
package com.durgasoft.android; import ......................................................................; public class DialogsExampleActivity extends Activity { private EditText time_et; private Button date_button; // Example for Dialog Boxes and the Menu @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); time_et=(EditText)findViewById(R.id.time_et); date_button=(Button)findViewById(R.id.b2); } private static int BASIC_DIALOG=1; private static int DATE_PICKER_DIALOG=2; private static int TIME_PICKER_DIALOG=3; private static int ALERT_DIALOG1=4; private static int ALERT_DIALOG2=5; public void button1Click(View v){ // Remove the comments One by One and check the result //showDialog(BASIC_DIALOG); //showDialog(ALERT_DIALOG2); showDialog(ALERT_DIALOG1); ; } public void button2Click(View v){ showDialog(DATE_PICKER_DIALOG); } public void button3Click(View v){ showDialog(TIME_PICKER_DIALOG); } public Dialog onCreateDialog(int index){ if(index==BASIC_DIALOG){ final Dialog d=new Dialog(this); d.setContentView(R.layout.dialog1_layout); Button b=(Button)d.findViewById(R.id.b2); By Mr. Mahesh
Durga Soft Solutions , SR Nagar , Hyderabad . www.durgasoft.com
46
b.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { d.dismiss(); } }); return d; }else if (index==DATE_PICKER_DIALOG){ OnDateSetListener dl= new OnDateSetListener() { public void onDateSet( DatePicker view, int year, int monthOfYear, int dayOfMonth) { Toast.makeText(getApplicationContext(), "Date : "+dayOfMonth+""+(monthOfYear+1)+"-"+year, Toast.LENGTH_SHORT).show(); date_button.setText("New : "+ dayOfMonth+"-"+(monthOfYear+1)+"-"+year); } }; DatePickerDialog dpd=new DatePickerDialog(this, return dpd; }else if (index==TIME_PICKER_DIALOG){
dl, 2011, 10, 12);
OnTimeSetListener dl=new OnTimeSetListener() { public void onTimeSet(TimePicker tp, int arg1,int arg2) { Toast.makeText(getApplicationContext(), "Time : "+arg1+":"+arg2, Toast.LENGTH_SHORT).show(); String text=""; if (arg1 <= 12){ text=arg1+":"+arg2+" AM"; }else{ text=(arg1-12)+":"+arg2+" PM"; } time_et.setText(text); } }; TimePickerDialog tpd= new TimePickerDialog( this,dl, 10, 12, false); return tpd; }else if (index == ALERT_DIALOG1){ AlertDialog.OnClickListener listener= new AlertDialog.OnClickListener(){ public void onClick( DialogInterface dialog, int which) { String text=""; if (which==AlertDialog.BUTTON_POSITIVE){ text="Positive : OK"; By Mr. Mahesh
Durga Soft Solutions , SR Nagar , Hyderabad . www.durgasoft.com
47
}else if(which==AlertDialog.BUTTON_NEGATIVE){ text="Natative : Not OK"; }else { text="Nutral : OK"; } Toast.makeText(getApplicationContext(), text, Toast.LENGTH_SHORT).show(); } }; AlertDialog.Builder ab= new AlertDialog.Builder(this); ab.setTitle("Alert Dialog Sample"); ab.setMessage("You opened AlertDialog"); ab.setPositiveButton("OK", listener); //ab.setNegativeButton("Not OK", listener); //ab.setNeutralButton("Neutral", listener); return ab.create(); }else if (index == ALERT_DIALOG2){ AlertDialog.Builder ab= new AlertDialog.Builder(this); ab.setTitle("Alert Dialog Sample"); final String[] items={"Abc1", "Abc2", "Abc3", "Abc4"}; DialogInterface.OnClickListener listener= new DialogInterface.OnClickListener() { public void onClick( DialogInterface dialog, int which) { Toast.makeText( getApplicationContext(), items[which], Toast.LENGTH_SHORT).show(); dialog.dismiss(); } }; ab.setItems(items, listener); return ab.create(); }else{ return null; } } public void onPrepareDialog(int index, Dialog d){ By Mr. Mahesh
Durga Soft Solutions , SR Nagar , Hyderabad . www.durgasoft.com
48
if (index==BASIC_DIALOG){ EditText ev=(EditText)d.findViewById(R.id.et1); TextView tv=(TextView)d.findViewById(R.id.tv1); tv.setText(tv.getText()+":"+ ev.getText()); } } @Override public boolean onCreateOptionsMenu( Menu menu) { MenuInflater mi=new MenuInflater(this); mi.inflate(R.menu.menu1, menu); return true; } @Override public boolean onMenuItemSelected( int featureId, MenuItem item) { Toast.makeText(getApplicationContext(), item.getTitle(), Toast.LENGTH_SHORT).show(); return true; } } Main.xml:
By Mr. Mahesh
Durga Soft Solutions , SR Nagar , Hyderabad . www.durgasoft.com
49
android:layout_height= "wrap_content" android:text="Alarm Date : " > dialog1_layout.xml:
By Mr. Mahesh
Durga Soft Solutions , SR Nagar , Hyderabad . www.durgasoft.com
50
my_tabs_view.xml:
Menu1.xml:
By Mr. Mahesh
Durga Soft Solutions , SR Nagar , Hyderabad . www.durgasoft.com