Program to add two numbers in Android

Steps to start and run adt on eclipse…
  1. Start Eclipse IDE from start Menu.
  2. Create a new project from eclipse.
  3. Create a MainActivity.java file.
  4. Create an activity_main.xml file for layout design which u want to implement.
  5. Add a button to trigger an event and three TextView fields in the XML layout to get the numbers as input and one for result.
  6. Then look up the button and EditText fields by their ids in the MainActivity.java file.
  7. Then define an addition code in the onClick function.
The following is the code.(It is the code of java which is the background code to do the events triggers etc.)
MainActivity.java
package com.example.additionof2no; 
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
public class MainActivity extends Activity implements OnClickListener{
EditText t1,t2,t3;
Button b1;
double d1,d2,d3;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
b1=(Button)findViewById(R.id.b2);
t1=(EditText)findViewById(R.id.t1);
t2=(EditText)findViewById(R.id.t2);
t3=(EditText)findViewById(R.id.t3);
b1.setOnClickListener(this);
}
public void onClick(View v) {
// this is auto generated code…TODO
d1=Double.parseDouble(t1.getText().toString());
d2=Double.parseDouble(t2.getText().toString());
d3=d1+d2;
t3.setText(Double.toString(d3));
}
}
activity_main.xml (It is used for front end of application of addition of 2 numbers )
<LinearLayout xmlns:android=http://schemas.android.com/apk/res/android&#8221;
    android:layout_width=“match_parent”
    android:layout_height=“match_parent”
    android:background=“@drawable/bluelilies”
    android:orientation=“vertical”
     >
<LinearLayout android:layout_width=“wrap_content”
    android:layout_height=“wrap_content”
    android:orientation=“horizontal”>
    <TextView android:layout_width=“wrap_content”
        android:layout_height=“wrap_content”
        android:text=“FN”/>
    <EditText android:layout_width=“fill_parent”
        android:layout_height=“wrap_content”
        android:id=“@+id/t1”
        android:hint=“Enter 1st No”/>
<LinearLayout android:layout_width=“wrap_content”
    android:layout_height=“wrap_content”
    android:orientation=“horizontal”>
    <TextView android:layout_width=“wrap_content”
        android:layout_height=“wrap_content”
        android:text=“SN”/>
    <EditText android:layout_width=“fill_parent”
        android:layout_height=“wrap_content”
        android:id=“@+id/t2”
        android:hint=“Enter 2nd No”/>
<LinearLayout android:layout_width=“wrap_content”
    android:layout_height=“wrap_content”
    android:orientation=“horizontal”>
    <TextView android:layout_width=“wrap_content”
        android:layout_height=“wrap_content”
        android:text=“Result”/>
    <EditText android:layout_width=“fill_parent”
        android:layout_height=“wrap_content”
        android:id=“@+id/t3”
      
<LinearLayout android:layout_width=“wrap_content”
    android:layout_height=“wrap_content”
    android:orientation=“horizontal”>
   
    <Button android:layout_width=“fill_parent”
        android:layout_height=“wrap_content”
        android:id=“@+id/b2”    
android:text=“Add “/>

Output….


That’s all done……..
Advertisements

HR Manager in Heaven…story

HR Manager in Heaven!!!

One day while walking down the street a highly successful HR Manager was hit by a bus and she died. Her soul arrived up in heaven where she was greeted by God himself.

“Welcome to Heaven,” said God. “

“Well, What we’re going to do is let you have a day in Hell and a day in Heaven and then you can choose whichever one you want to spend an eternity in.”

“Actually, I think I’ve made up my mind, I prefer to stay in Heaven”, said the woman.

“Sorry, we have rules.”

And with that God put the HR Manager in an elevator and it went down-down-down to hell.

The doors opened and she found herself stepping out onto the hell wt beautiful golf course. And a country club and standing in front of her were all her friends – fellow executives that she had worked with and they were well dressed in evening gowns and cheering for her. they talked about old times.
She met the Devil who was really a nice guy and She was having such a good time that before she knew it, it was time to leave.

Everybody waved goodbye as she got on the elevator.

The elevator went up-up-up and opened back up at the Pearly Gates and found God waiting for her.

“Now it’s time to spend a day in heaven,” he said. So she spent the next 24 hours around on clouds and playing the harp and singing. She had great time and before she knew it her 24 hours were up and God came and got her.

“So, you’ve spent a day in hell and in heaven. Now u must choose ur eternity,”

The woman paused for a second and then replied, “Well, I never thought I’d say this, I mean, Heaven has been really great and all, but I think I had a better time in Hell.”

So God escorted her to the elevator and again she went down-down-down back to Hell.

When the doors of the elevator opened she found herself standing in a desolate wasteland covered in garbage and filth. She saw her friends were dressed in rags and were picking up the garbage and putting it in sacks.

The Devil came up to her and put his arm around her.

“I don’t understand,” stammered the woman, “yesterday I was here and there was a golf course and a country club and we ate lobster and we danced and had a great time. Now all there is a wasteland of garbage and all my friends look miserable.”

The Devil looked at her smiled and said:



….
….

“Yesterday we were recruiting you, today you’re an Employee”.

Very useful Short forms….

VERY USEFUL SHORT FORMS

1.) GOOGLE : Global Organization Of Oriented
Group Language Of Earth .(unofficial)

2.) YAHOO : Yet Another Hierarchical Officious
Oracle .
3.) WINDOW : Wide Interactive Network
Development for Office work Solution
4.) COMPUTER : Common Oriented Machine
Particularly United and used under Technical
and Educational Research.
5.) VIRUS : Vital Information Resources Under
Siege .
6.) UMTS : Universal Mobile Telecommunications
System .
7.) AMOLED: Active-matrix organic light-emitting
diode
8.) OLED : Organic light-emitting diode
9.) IMEI: International Mobile Equipment
Identity .
10.) ESN: Electronic Serial Number .
11.) UPS: uninterruptible power supply .
12). HDMI: High-Definition Multimedia Interface
13.) VPN: virtual private network
14.) APN: Access Point Name
15.) SIM: Subscriber Identity Module
16.) LED: Light emitting diode.
17.) DLNA: Digital Living Network Alliance
18.) RAM: Random access memory.
19.) ROM: Read only memory.
20) VGA: Video Graphics Array
21) QVGA: Quarter Video Graphics Array
22) WVGA: Wide video graphics array.
23) WXGA: Widescreen Extended Graphics Array
24) USB: Universal serial Bus
25) WLAN: Wireless Local Area Network
26.) PPI: Pixels Per Inch
27.) LCD: Liquid Crystal Display.
28.) HSDPA: High speed down-link packet access.
29.) HSUPA: High-Speed Uplink Packet Access
30.) HSPA: High Speed Packet Access
31.) GPRS: General Packet Radio Service
32.) EDGE: Enhanced Data Rates for Global
Evolution
33.)NFC: Near field communication
34.) OTG: on-the-go
35.) S-LCD: Super Liquid Crystal Display
36.) O.S: Operating system.
37.) SNS: Social network service
38.) H.S: HOTSPOT
39.) P.O.I: point of interest
40.)GPS: Global Positioning System
41.)DVD: Digital Video Disk / digital versatile disc
42.)DTP: Desk top publishing.
43.) DNSE: Digital natural sound engine .
44.) OVI: Ohio Video Intranet
45.)CDMA: Code Division Multiple Access
46.) WCDMA: Wide-band Code Division Multiple
Access
47.)GSM: Global System for Mobile
Communications
48.)WI-FI: Wireless Fidelity
49.) DIVX: Digital internet video access.
50.) .APK: authenticated public key.
51.) J2ME: java 2 micro edition
53.) DELL: Digital electronic link library.
54.)ACER: Acquisition Collaboration
Experimentation Reflection
55.)RSS: Really simple syndication
56.) TFT: thin film transistor
57.) AMR: Adaptive Multi- Rate
58.) MPEG: moving pictures experts group
59.)IVRS: Interactive Voice Response System
60.) HP: Hewlett Packard

Top Ten Technology Which will change Your Life

The full list of the top ten emerging technologies:
Brain-computer interfaces: It is already possible to type just by monitoring the electrical activity of your brain, but as the technology advances, it could be possible for people with disabilities to operate wheelchairs using only their thoughts
.



Mining metals from desalination brine: Large-scale desalination is becoming economically feasible for the first time because of new chemical processes that enable the mining of metals from waste water, or brine.

Nanostructured carbon composites: Cars made from carbon-fibre reinforced composites are as much as 40% lighter than older models, stronger, and more easy to recycle, offering the prospect for huge energy savings.

Grid-scale electricity storage: A fundamental breakthrough is close that would allow the saving of surplus energy from fluctuating renewable sources such as sun and wind within the electricity grid.





Body-adapted wearable electronics: Whether worn on the body, embedded in clothes or even under the skin, these devices can track information, such as heart rate and stress levels, giving people real-time feedback about their health.


Nanowire lithium-ion batteries: New batteries based on silicon – using tiny silicon nanowires – could have a longer life, charge more quickly and hold up to three times the power of existing batteries.




Screenless display: A 3D image projected into space – a “screenless display” – can convey information that a 2D image presented on a screen cannot, and is close to becoming a practical reality.






Human microbiome therapeutics: Drawing on knowledge gained from the Human Microbiome Project in 2012 and other research, human microbiome technology is increasingly seen as an important source of treatment for serious diseases as well as for improving health.





RNA-based therapeutics: RNA, like DNA, plays a part in protein synthesis and, to a lesser extent, the transmission of genetic information. Scientific advances are combining to enable a new generation of targeted, RNA-based drugs that could help find new treatments for cancer and infectious diseases




Quantified self (predictive analytics): RNA, like DNA, plays a part in protein synthesis and, to a lesser extent, the transmission of genetic information. Scientific advances are combining to enable a new generation of targeted, RNA-based drugs that could help find new treatments for cancer and infectious diseases
From:-http://www.telegraph.co.uk/