Skip to content

Commit fc84a87

Browse files
committed
updated examples
1 parent 8040918 commit fc84a87

File tree

13 files changed

+623
-38
lines changed

13 files changed

+623
-38
lines changed
Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="de.vogella.android.temperature" android:versionCode="1"
4-
android:versionName="1.0">
5-
<application android:icon="@drawable/icon" android:label="@string/app_name">
6-
<activity android:name=".Convert" android:label="@string/app_name">
7-
<intent-filter>
8-
<action android:name="android.intent.action.MAIN" />
9-
<category android:name="android.intent.category.LAUNCHER" />
10-
</intent-filter>
11-
</activity>
3+
package="de.vogella.android.temperature"
4+
android:versionCode="1"
5+
android:versionName="1.0">
6+
<uses-sdk android:minSdkVersion="9" />
127

13-
</application>
14-
<uses-sdk android:minSdkVersion="9" />
8+
<application android:icon="@drawable/icon" android:label="@string/app_name">
9+
<activity android:name=".Convert"
10+
android:label="@string/app_name">
11+
<intent-filter>
12+
<action android:name="android.intent.action.MAIN" />
13+
<category android:name="android.intent.category.LAUNCHER" />
14+
</intent-filter>
15+
</activity>
1516

16-
</manifest>
17+
</application>
18+
</manifest>
Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3-
android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/myColor">
4-
5-
<EditText android:id="@+id/EditText01" android:layout_height="wrap_content" android:layout_width="fill_parent" android:inputType="numberSigned|numberDecimal"></EditText>
6-
<RadioGroup android:id="@+id/RadioGroup01"
7-
android:layout_width="wrap_content" android:layout_height="wrap_content">
8-
<RadioButton android:id="@+id/RadioButton01"
9-
android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/celsius" android:checked="true"></RadioButton>
10-
<RadioButton android:id="@+id/RadioButton02"
11-
android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/fahrenheit"></RadioButton>
3+
android:orientation="vertical" android:layout_width="fill_parent"
4+
android:layout_height="fill_parent" android:background="@color/myColor">
5+
<EditText android:layout_height="wrap_content" android:id="@+id/editText1"
6+
android:layout_width="match_parent" android:inputType="numberDecimal|numberSigned"></EditText>
7+
<RadioGroup android:layout_height="wrap_content" android:id="@+id/radioGroup1"
8+
android:layout_width="match_parent">
9+
<RadioButton android:layout_width="wrap_content"
10+
android:id="@+id/radio0" android:layout_height="wrap_content"
11+
android:text="@string/celsius" android:checked="true"></RadioButton>
12+
<RadioButton android:layout_width="wrap_content"
13+
android:id="@+id/radio1" android:layout_height="wrap_content"
14+
android:text="@string/fahrenheit"></RadioButton>
1215
</RadioGroup>
13-
<Button android:id="@+id/Button01"
14-
android:layout_height="wrap_content" android:onClick="@string/buttonHandler" android:layout_width="wrap_content" android:text="@string/calc"></Button>
16+
<Button android:id="@+id/button1" android:layout_width="wrap_content"
17+
android:layout_height="wrap_content" android:text="@string/calc"
18+
android:onClick="myClickHandler"></Button>
1519
</LinearLayout>

de.vogella.android.temperature/res/values-de/strings.xml

Lines changed: 0 additions & 10 deletions
This file was deleted.

de.vogella.android.temperature/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<string name="hello">Hello World, Convert!</string>
44
<string name="app_name">Temperature Convertor</string>
55
<color name="myColor">#3399CC</color>
6-
<string name="buttonHandler">myClickHandler</string>
6+
<string name="myClickHandler">myClickHandler</string>
77
<string name="celsius">to Celsius</string>
88
<string name="fahrenheit">to Fahrenheit</string>
99
<string name="calc">Calculate</string>

de.vogella.android.temperature/src/de/vogella/android/temperature/Convert.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
package de.vogella.android.temperature;
23

34
import android.app.Activity;
@@ -14,17 +15,17 @@ public class Convert extends Activity {
1415
public void onCreate(Bundle savedInstanceState) {
1516
super.onCreate(savedInstanceState);
1617
setContentView(R.layout.main);
17-
text = (EditText) findViewById(R.id.EditText01);
18+
text = (EditText) findViewById(R.id.editText1);
1819

1920
}
2021

2122
// This method is called at button click because we assigned the name to the
2223
// "On Click property" of the button
2324
public void myClickHandler(View view) {
2425
switch (view.getId()) {
25-
case R.id.Button01:
26-
RadioButton celsiusButton = (RadioButton) findViewById(R.id.RadioButton01);
27-
RadioButton fahrenheitButton = (RadioButton) findViewById(R.id.RadioButton02);
26+
case R.id.button1:
27+
RadioButton celsiusButton = (RadioButton) findViewById(R.id.radio0);
28+
RadioButton fahrenheitButton = (RadioButton) findViewById(R.id.radio1);
2829
if (text.getText().length() == 0) {
2930
Toast.makeText(this, "Please enter a valid number",
3031
Toast.LENGTH_LONG).show();

de.vogella.concurrency.callables/src/de/vogella/concurrency/callables/CallableFutures.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,6 @@ public static void main(String[] args) {
3333
}
3434
}
3535
System.out.println(sum);
36+
executor.shutdown();
3637
}
3738
}

de.vogella.java.io/.classpath

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="src"/>
4+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
5+
<classpathentry kind="output" path="bin"/>
6+
</classpath>

de.vogella.java.io/.project

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>de.vogella.java.io</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.jdt.core.javanature</nature>
16+
</natures>
17+
</projectDescription>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#Tue Jan 25 23:01:01 CET 2011
2+
eclipse.preferences.version=1
3+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
4+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
5+
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
6+
org.eclipse.jdt.core.compiler.compliance=1.6
7+
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
8+
org.eclipse.jdt.core.compiler.debug.localVariable=generate
9+
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
10+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
11+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12+
org.eclipse.jdt.core.compiler.source=1.6

0 commit comments

Comments
 (0)