Here is one of the simplest Android App:
Temperature Converter - It converts Temperature from Degree Celsius to Degree Fahrenheit and vice versa.
Tha App can be found in Market at :
https://play.google.com/store/apps/details?id=ind.zaki.android.temp.converter
Here is the code:
Androidmanifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ind.zaki.android.temp.converter"
android:versionCode="2"
android:versionName="2.0"
android:installLocation="auto"
>
<uses-sdk android:minSdkVersion="10" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:label="@string/app_name"
android:name=".DtoFActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
DToFActivity.java
package ind.zaki.android.temp.converter;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class DtoFActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
((Button) findViewById(R.id.calculate))
.setOnClickListener(new Button.OnClickListener() {
public void onClick(View arg0) {
final EditText degreesText = (EditText) DtoFActivity.this
.findViewById(R.id.degrees);
final EditText fahrenheitText = (EditText) DtoFActivity.this
.findViewById(R.id.fahrenheit);
if (!"".equals(degreesText.getText().toString())) {
fahrenheitText.setText(String.valueOf((Float
.valueOf(degreesText.getText().toString()) * 9 / 5) + 32));
}
}
});
((Button) findViewById(R.id.calculate2))
.setOnClickListener(new Button.OnClickListener() {
public void onClick(View arg0) {
final EditText degreesText = (EditText) DtoFActivity.this
.findViewById(R.id.degrees);
final EditText fahrenheitText = (EditText) DtoFActivity.this
.findViewById(R.id.fahrenheit);
if (!"".equals(fahrenheitText.getText().toString())) {
degreesText.setText(String.valueOf((Float
.valueOf(fahrenheitText.getText()
.toString()) - 32) * 5 / 9));
}
}
});
}
}
main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@drawable/background">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/degrees" />
<EditText
android:id="@+id/degrees"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="phone" >
<requestFocus />
</EditText>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/fahrenheit" />
<EditText
android:id="@+id/fahrenheit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="phone" />
<Button
android:id="@+id/calculate"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Degrees to FahrenHeit" />
<Button
android:id="@+id/calculate2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="FahrenHeit to Degrees" />
</LinearLayout>
Temperature Converter - It converts Temperature from Degree Celsius to Degree Fahrenheit and vice versa.
Tha App can be found in Market at :
https://play.google.com/store/apps/details?id=ind.zaki.android.temp.converter
Here is the code:
Androidmanifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ind.zaki.android.temp.converter"
android:versionCode="2"
android:versionName="2.0"
android:installLocation="auto"
>
<uses-sdk android:minSdkVersion="10" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:label="@string/app_name"
android:name=".DtoFActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
DToFActivity.java
package ind.zaki.android.temp.converter;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class DtoFActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
((Button) findViewById(R.id.calculate))
.setOnClickListener(new Button.OnClickListener() {
public void onClick(View arg0) {
final EditText degreesText = (EditText) DtoFActivity.this
.findViewById(R.id.degrees);
final EditText fahrenheitText = (EditText) DtoFActivity.this
.findViewById(R.id.fahrenheit);
if (!"".equals(degreesText.getText().toString())) {
fahrenheitText.setText(String.valueOf((Float
.valueOf(degreesText.getText().toString()) * 9 / 5) + 32));
}
}
});
((Button) findViewById(R.id.calculate2))
.setOnClickListener(new Button.OnClickListener() {
public void onClick(View arg0) {
final EditText degreesText = (EditText) DtoFActivity.this
.findViewById(R.id.degrees);
final EditText fahrenheitText = (EditText) DtoFActivity.this
.findViewById(R.id.fahrenheit);
if (!"".equals(fahrenheitText.getText().toString())) {
degreesText.setText(String.valueOf((Float
.valueOf(fahrenheitText.getText()
.toString()) - 32) * 5 / 9));
}
}
});
}
}
main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@drawable/background">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/degrees" />
<EditText
android:id="@+id/degrees"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="phone" >
<requestFocus />
</EditText>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/fahrenheit" />
<EditText
android:id="@+id/fahrenheit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="phone" />
<Button
android:id="@+id/calculate"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Degrees to FahrenHeit" />
<Button
android:id="@+id/calculate2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="FahrenHeit to Degrees" />
</LinearLayout>