Skip to content

Commit 4132370

Browse files
committed
update exapmles
1 parent 616fdd7 commit 4132370

30 files changed

Lines changed: 381 additions & 43 deletions

File tree

‎com.example.android.rssfeed/res/layout/main.xml‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
android:orientation="vertical" android:layout_width="fill_parent"
44
android:layout_height="fill_parent">
5-
<LinearLayout android:id="@+id/linearLayout1" android:layout_height="wrap_content" android:layout_width="match_parent">
6-
<Button android:onClick="parseRss" android:text="Read RSS Feed" android:layout_height="wrap_content" android:id="@+id/readRss" android:layout_width="wrap_content"></Button>
7-
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/textViewCount"></TextView>
8-
</LinearLayout>
5+
<LinearLayout android:id="@+id/linearLayout1"
6+
android:layout_height="wrap_content" android:layout_width="match_parent">
7+
<Button android:onClick="parseRss" android:text="Read RSS Feed"
8+
android:layout_height="wrap_content" android:id="@+id/readRss"
9+
android:layout_width="wrap_content"></Button>
10+
<TextView android:layout_width="wrap_content"
11+
android:layout_height="wrap_content" android:id="@+id/textViewCount"></TextView>
12+
</LinearLayout>
913
</LinearLayout>

‎com.example.android.rssfeed/src/com/example/android/rssfeed/ReadRssFeed.java‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import android.app.Activity;
1010
import android.os.AsyncTask;
1111
import android.os.Bundle;
12-
import android.os.StrictMode;
1312
import android.util.Log;
1413
import android.util.Xml;
1514
import android.view.View;
@@ -27,18 +26,20 @@ public class ReadRssFeed extends Activity {
2726
/** Called when the activity is first created. */
2827
@Override
2928
public void onCreate(Bundle savedInstanceState) {
30-
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
31-
.detectAll().penaltyLog().penaltyDeath().build());
32-
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll()
33-
.penaltyLog().penaltyDeath().build());
29+
// StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
30+
// .detectAll().penaltyLog().penaltyDeath().build());
31+
// StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll()
32+
// .penaltyLog().penaltyDeath().build());
3433

3534
super.onCreate(savedInstanceState);
3635
setContentView(R.layout.main);
3736
}
3837

39-
public void parseRss(View view) {
38+
public void readRss(View view) {
4039
if (parseTask != null) {
41-
40+
parseTask = new ParseTask(this);
41+
parseTask
42+
.execute(new String[] { "http://www.vogella.de/article.rss" });
4243
}
4344
}
4445

@@ -94,7 +95,9 @@ public List<RssItem> parse(String rssFeed) {
9495
} catch (Exception e) {
9596
throw new RuntimeException(e);
9697
}
98+
Log.e("Elements", String.valueOf(list.size()));
9799
return list;
100+
98101
}
99102

100103
private static class ParseTask extends
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="src"/>
4+
<classpathentry kind="src" path="gen"/>
5+
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
6+
<classpathentry kind="output" path="bin"/>
7+
</classpath>
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>de.vogella.android.gestures.code</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: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="de.vogella.android.gestures.code"
4+
android:versionCode="1"
5+
android:versionName="1.0">
6+
<uses-sdk android:minSdkVersion="10" />
7+
8+
<application android:icon="@drawable/icon" android:label="@string/app_name">
9+
<activity android:name=".SwipeTest"
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>
16+
17+
</application>
18+
</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+
# "build.properties", and override values to adapt the script to your
8+
# project structure.
9+
10+
# Project target.
11+
target=android-10
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
-optimizationpasses 5
2+
-dontusemixedcaseclassnames
3+
-dontskipnonpubliclibraryclasses
4+
-dontpreverify
5+
-verbose
6+
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
7+
8+
-keep public class * extends android.app.Activity
9+
-keep public class * extends android.app.Application
10+
-keep public class * extends android.app.Service
11+
-keep public class * extends android.content.BroadcastReceiver
12+
-keep public class * extends android.content.ContentProvider
13+
-keep public class * extends android.app.backup.BackupAgentHelper
14+
-keep public class * extends android.preference.Preference
15+
-keep public class com.android.vending.licensing.ILicensingService
16+
17+
-keepclasseswithmembernames class * {
18+
native <methods>;
19+
}
20+
21+
-keepclasseswithmembernames class * {
22+
public <init>(android.content.Context, android.util.AttributeSet);
23+
}
24+
25+
-keepclasseswithmembernames class * {
26+
public <init>(android.content.Context, android.util.AttributeSet, int);
27+
}
28+
29+
-keepclassmembers enum * {
30+
public static **[] values();
31+
public static ** valueOf(java.lang.String);
32+
}
33+
34+
-keep class * implements android.os.Parcelable {
35+
public static final android.os.Parcelable$Creator *;
36+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Copyright (C) 2008 The Android Open Source Project
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
17+
<set xmlns:android="http://schemas.android.com/apk/res/android">
18+
<translate android:fromXDelta="100%p" android:toXDelta="0" android:duration="800"/>
19+
</set>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Copyright (C) 2008 The Android Open Source Project
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
17+
<set xmlns:android="http://schemas.android.com/apk/res/android">
18+
<translate android:fromXDelta="0" android:toXDelta="-100%p" android:duration="800"/>
19+
</set>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Copyright (C) 2008 The Android Open Source Project
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
17+
<set xmlns:android="http://schemas.android.com/apk/res/android">
18+
<translate android:fromXDelta="-100%p" android:toXDelta="0" android:duration="800"/>
19+
</set>

0 commit comments

Comments
 (0)