Skip to content

Commit 0576023

Browse files
committed
updates
1 parent ba90fd6 commit 0576023

File tree

60 files changed

+788
-110
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+788
-110
lines changed

TutorialMapsAccToDo/src/de/vogella/tutorial/maps2/TutorialMapActivity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ protected void onResume() {
175175
if (provider != null) {
176176
locationManager.requestLocationUpdates(provider, 500, 5, this);
177177
}
178+
178179
// TODO myLocationOverlay: Compass und "MyLocation" "enablen"
179180
}
180181

TutorialServiceTodo/src/de/vogella/android/intentservice/download/DownloadService.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import android.os.Environment;
1616
import android.os.Message;
1717
import android.os.Messenger;
18-
import android.util.Log;
1918

2019
public class DownloadService extends IntentService {
2120

@@ -40,6 +39,8 @@ protected void onHandleIntent(Intent intent) {
4039
Uri data = intent.getData();
4140
String urlPath = intent.getStringExtra("urlpath");
4241
String fileName = data.getLastPathSegment();
42+
43+
// Create file and download the requested URL
4344
File output = new File(Environment.getExternalStorageDirectory(),
4445
fileName);
4546
if (output.exists()) {
@@ -82,17 +83,18 @@ protected void onHandleIntent(Intent intent) {
8283

8384
Bundle extras = intent.getExtras();
8485
if (extras != null) {
86+
87+
// We retrieve the messenger from the intent extras
8588
Messenger messenger = (Messenger) extras.get("MESSENGER");
8689
Message msg = Message.obtain();
8790
msg.arg1 = result;
88-
Bundle bundle = new Bundle();
89-
bundle.putString("absolutePath", output.getAbsolutePath());
90-
msg.setData(bundle);
91-
try {
92-
messenger.send(msg);
93-
} catch (android.os.RemoteException e1) {
94-
Log.w(getClass().getName(), "Exception sending message", e1);
95-
}
91+
92+
// TODO 5 Create new Bundle and put output.getAbsolutePath() into it
93+
94+
// TODO 6 - Use setData of the msg to add the bundle
95+
96+
// TODO 7 - Send the msg to the messenger and catch the remove
97+
// expection
9698

9799
}
98100
}

TutorialServiceTodo/src/de/vogella/android/intentservice/download/MainActivity.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class MainActivity extends Activity {
1515
public void handleMessage(Message message) {
1616
Bundle data = message.getData();
1717
if (message.arg1 == RESULT_OK && data != null) {
18-
// TODO 3 - get the path from the service and show as Toast
18+
// TODO 5 - get the path from the service and show as Toast
1919
} else {
2020
Toast.makeText(MainActivity.this, "Download failed.",
2121
Toast.LENGTH_LONG).show();
@@ -42,13 +42,14 @@ public void onClick(View view) {
4242
// Create a new Messenger for the communication back
4343
Messenger messenger = new Messenger(handler);
4444

45-
// TODO 2 - Put the instance of Messenger into the Intent as Extra
45+
// TODO 2 - Put the instance of Messenger into the Intent as Extra, use
46+
// the key "MESSENGER"
4647

4748
// Setting the data for the service to work on
4849
intent.setData(Uri.parse("http://www.vogella.de/index.html"));
4950
intent.putExtra("urlpath", "http://www.vogella.de/index.html");
5051

51-
// TODO 2 - start the service
52+
// TODO 3 - start the service
5253

5354
}
5455

TutorialWidgetSolution/.classpath

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="src"/>
4+
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
5+
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
6+
<classpathentry kind="src" path="gen"/>
7+
<classpathentry kind="output" path="bin/classes"/>
8+
</classpath>

TutorialWidgetSolution/.project

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>TutorialWidgetSolution</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
<buildCommand>
19+
<name>org.eclipse.jdt.core.javabuilder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
<buildCommand>
24+
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
25+
<arguments>
26+
</arguments>
27+
</buildCommand>
28+
</buildSpec>
29+
<natures>
30+
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
31+
<nature>org.eclipse.jdt.core.javanature</nature>
32+
</natures>
33+
</projectDescription>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="de.vogella.android.widget.example"
4+
android:versionCode="1"
5+
android:versionName="1.0" >
6+
7+
<uses-sdk android:minSdkVersion="15" />
8+
9+
<application
10+
android:icon="@drawable/icon"
11+
android:label="@string/app_name" >
12+
<receiver
13+
android:name="MyWidgetProviderSimple"
14+
android:icon="@drawable/icon"
15+
android:label="Simple Example Widget" >
16+
<intent-filter>
17+
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
18+
</intent-filter>
19+
20+
<meta-data
21+
android:name="android.appwidget.provider"
22+
android:resource="@xml/widgetsimple_info" />
23+
</receiver>
24+
</application>
25+
26+
</manifest>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# This file is automatically generated by Android Tools.
2+
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3+
#
4+
# This file must be checked in Version Control Systems.
5+
#
6+
# To customize properties used by the Ant build system use,
7+
# "ant.properties", and override values to adapt the script to your
8+
# project structure.
9+
10+
# Project target.
11+
target=android-15
4.05 KB
Loading
1.68 KB
Loading
2.51 KB
Loading

0 commit comments

Comments
 (0)