how to get rss feed in an android app page from a live website?
I have an ASP.NET website and I want to develop simple android application with 1 page in which I want to get live data from RSS FEED of my website.
The link of my website rss feed is like: http://www.mydomain.com/latestnewsrss.aspx?languageid=7
In the android application I just want to display all the news coming from RSS FEED of website in a list.
I am following this tutorial but it is not running (I don't know why): http://nscraps.com/Java/523-rss-feed-reader-example-java.htm
when I try to run the my code on phone, I get error saying "force app to stop/close"
------------log cat-------------
07-18 19:24:27.657: ERROR/Zygote(33): setreuid() failed. errno: 2
07-18 19:24:27.657: ERROR/Zygote(33): setreuid() failed. errno: 17
07-18 19:24:27.657: ERROR/BatteryService(55): usbOnlinePath not found
07-18 19:24:27.657: ERROR/BatteryService(55): batteryVoltagePath not found
07-18 19:24:27.657: ERROR/BatteryService(55): batteryTemperaturePath not found
07-18 19:24:27.657: ERROR/SurfaceFlinger(55): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
07-18 19:24:46.946: ERROR/EventHub(55): could not get driver version for /dev/input/mouse0, Not a typewriter
07-18 19:24:46.946: ERROR/EventHub(55): could not get driver version for /dev/input/mice, Not a typewriter
07-18 19:24:47.268: ERROR/System(55): Failure starting core service
07-18 19:24:47.268: ERROR/System(55): java.lang.SecurityException
07-18 19:24:47.268: ERROR/System(55): at android.os.BinderProxy.transact(Native Method)
07-18 19:24:47.268: ERROR/System(55): at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
07-18 19:24:47.268: ERROR/System(55): at android.os.ServiceManager.addService(ServiceManager.java:72)
07-18 19:24:47.268: ERROR/System(55): at com.android.server.ServerThread.run(SystemServer.java:184)
07-18 19:24:49.516: ERROR/SoundPool(55): error loading /system/media/audio/ui/Effect_Tick.ogg
07-18 19:24:49.546: ERROR/SoundPool(55): error loading /system/media/audio/ui/KeypressStandard.ogg
07-18 19:24:49.556: ERROR/SoundPool(55): error loading /system/media/audio/ui/KeypressSpacebar.ogg
07-18 19:24:49.566: ERROR/SoundPool(55): error loading /system/media/audio/ui/KeypressDelete.ogg
07-18 19:24:49.566: ERROR/SoundPool(55): error loading /system/media/audio/ui/KeypressReturn.ogg
07-18 19:24:52.717: ERROR/ThrottleService(55): Could not open GPS configuration file /etc/gps.conf
07-18 19:24:54.207: ERROR/logwrapper(143): executing /system/bin/tc failed: No such file or directory
07-18 19:24:54.257: ERROR/logwrapper(145): executing /system/bin/tc failed: No such file or directory
07-18 19:24:54.378: ERROR/logwrapper(146): executing /system/bin/tc failed: No such file or directory
07-18 19:25:15.453: ERROR/HierarchicalStateMachine(55): TetherMaster - unhandledMessage: msg.what=3
07-18 19:25:36.650: ERROR/ActivityManager(55): ANR in com.android.quicksearchbox
07-18 19:25:36.650: ERROR/ActivityManager(55): Reason: Broadcast of Intent { act=android.appwidget.action.APPWIDGET_ENABLED cmp=com.android.quicksearchbox/.SearchWidgetProvider }
07-18 19:25:36.650: ERROR/ActivityManager(55): Load: 4.92 / 1.38 / 0.47
07-18 19:25:36.650: ERROR/ActivityManager(55): CPU usage from 16126ms to 203ms ago:
07-18 19:25:36.650: ERROR/ActivityManager(55): ndroid.launcher: 38% = 23% user + 14% kernel / faults: 5232 minor 63 major
07-18 19:25:36.650: ERROR/ActivityManager(55): system_server: 23% = 10% user + 13% kernel / faults: 2891 minor 75 major
07-18 19:25:36.650: ERROR/ActivityManager(55): m.android.email: 17% = 8% user + 9% kernel / faults: 4012 minor 14 major
07-18 19:25:36.650: ERROR/ActivityManager(55): d.process.media: 17% = 9% user + 7% kernel / faults: 4273 minor 7 major
07-18 19:25:36.650: ERROR/ActivityManager(55): com.android.mms: 15% = 7% user + 7% kernel / faults: 3952 minor 9 major
07-18 19:25:36.650: ERROR/ActivityManager(55): m.android.phone: 3% = 2% user + 1% kernel / faults: 857 minor 7 major
07-18 19:25:36.650: ERROR/ActivityManager(55): adbd: 3% = 0% user + 3% kernel
07-18 19:25:36.650: ERROR/ActivityManager(55): d.process.acore: 3% = 2% user + 1% kernel / faults: 1710 minor 48 major
07-18 19:25:36.650: ERROR/ActivityManager(55): id.defcontainer: 1% = 0% user + 0% kernel / faults: 563 minor
07-18 19:25:36.650: ERROR/ActivityManager(55): kswapd0: 0% = 0% user + 0% kernel
07-18 19:25:36.650: ERROR/ActivityManager(55): zygote: 0% = 0% user + 0% kernel / faults: 159 minor
07-18 19:25:36.650: ERROR/ActivityManager(55): roid.alarmclock: 0% = 0% user + 0% kernel / faults: 175 minor
07-18 19:25:36.650: ERROR/ActivityManager(55): ronsoft.openwnn: 0% = 0% user + 0% kernel / faults: 174 minor
07-18 19:25:36.650: ERROR/ActivityManager(55): mmcqd: 0% = 0% user + 0% kernel
07-18 19:25:36.650: ERROR/ActivityManager(55): mediaserver: 0% = 0% user + 0% kernel / faults: 37 minor 2 major
07-18 19:25:36.650: ERROR/ActivityManager(55): init: 0% = 0% user + 0% kernel / faults: 1 minor
07-18 19:25:36.650: ERROR/ActivityManager(55): pdflush: 0% = 0% user + 0% kernel
07-18 19:25:36.650: ERROR/ActivityManager(55): rild: 0% = 0% user + 0% kernel / faults: 55 minor 2 major
07-18 19:25:36.650: ERROR/ActivityManager(55): qemud: 0% = 0% user + 0% kernel / faults: 13 minor
07-18 19:25:36.650: ERROR/ActivityManager(55): logcat: 0% = 0% user + 0% kernel / faults: 53 minor
07-18 19:25:36.650: ERROR/ActivityManager(55): ndroid.settings: 0% = 0% user + 0% kernel / faults: 113 minor
07-18 19:25:36.650: ERROR/ActivityManager(55): +android.protips: 0% = 0% user + 0% kernel
07-18 19:25:36.650: ERROR/ActivityManager(55): +.quicksearchbox: 0% = 0% user + 0% kernel
07-18 19:25:36.650: ERROR/ActivityManager(55): +loop0: 0% = 0% user + 0% kernel
07-18 19:25:36.650: ERROR/ActivityManager(55): +kdmflush: 0% = 0% user + 0% kernel
07-18 19:25:36.650: ERROR/ActivityManager(55): +kcryptd_io: 0% = 0% user + 0% kernel
07-18 19:25:36.650: ERROR/ActivityManager(55): +kcryptd: 0% = 0% user + 0% kernel
07-18 19:25:36.650: ERROR/ActivityManager(55): +newfs_msdos: 0% = 0% user + 0% kernel
07-18 19:25:36.650: ERROR/ActivityManager(55): TOTAL: 100% = 50% user + 48% kernel + 0% iowait + 0% irq + 0% softirq
07-18 19:25:55.430: ERROR/AndroidRuntime(305): FATAL EXCEPTION: main
07-18 19:25:55.430: ERROR/AndroidRuntime(305): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.RssFeed/com.RssFeed.RssFeed}: java.lang.IllegalAccessException: access to constructor not allowed
07-18 19:25:55.430: ERROR/AndroidRuntime(305): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
07-18 19:25:55.430: ERROR/AndroidRuntime(305): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
07-18 19:25:55.430: ERROR/AndroidRuntime(305): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
07-18 19:25:55.430: ERROR/AndroidRuntime(305): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
07-18 19:25:55.430: ERROR/AndroidRuntime(305): at android.os.Handler.dispatchMessage(Handler.java:99)
07-18 19:25:55.430: ERROR/AndroidRuntime(305): at android.os.Looper.loop(Looper.java:123)
07-18 19:25:55.430: ERROR/AndroidRuntime(305): at android.app.ActivityThread.main(ActivityThread.java:4627)
07-18 19:25:55.430: ERROR/AndroidRuntime(305): at java.lang.reflect.Method.invokeNative(Native Method)
07-18 19:25:55.430: ERROR/AndroidRuntime(305): at java.lang.reflect.Method.invoke(Method.java:521)
07-18 19:25:55.430: ERROR/AndroidRuntime(305): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-18 19:25:55.430: ERROR/AndroidRuntime(305): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-18 19:25:55.430: ERROR/AndroidRuntime(305): at dalvik.system.NativeStart.main(Native Method)
07-18 19:25:55.430: ERROR/AndroidRuntime(305): Caused by: java.lang.IllegalAccessException: access to constructor not allowed
07-18 19:25:55.430: ERROR/AndroidRuntime(305): at java.lang.Class.newInstanceImpl(Native Method)
07-18 19:25:55.430: ERROR/AndroidRuntime(305): at java.lang.Class.newInstance(Class.java:1429)
07-18 19:25:55.430: ERROR/AndroidRuntime(305): at android.app.Instrumentation.newActivity开发者_高级运维(Instrumentation.java:1021)
07-18 19:25:55.430: ERROR/AndroidRuntime(305): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
07-18 19:25:55.430: ERROR/AndroidRuntime(305): ... 11 more
Need Help
I see that an IllegalAccessException: access to constructor not allowed
exception is thrown. Do you provide your own constructor to your activity? For example, do you have something like this:
public class YourActivity extends Activity {
YourActivity() {
}
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
If so, bear in mind that this is not the way activities work. You should not provide a constructor for the activity. Instead, do all your initialisations in the onCreate()
method.
Another problem could be that you want to instantiate your activity like YourActivity activity = new YourActivity();
. This is also wrong.
Please take a look here for better understanding the Activity lifecycle.
精彩评论