Pkmmte / PkRSS

A powerful RSS feed manager for Android
Apache License 2.0
100 stars 23 forks source link

articleList null Why?? #11

Closed GerhardPue closed 9 years ago

GerhardPue commented 9 years ago

private static final String RSS_URL = "http://techdissected.com/category/google/feed/";

PkRSS.with(this).load(RSS_URL).async();

List< Article > articleList = PkRSS.with(this).get(RSS_URL);

articleList every time null ??? Why??

Pkmmte commented 9 years ago

Looks like you're loading the feed in the background first and trying to get the results before it finishes loading.

Either try replacing .async() with .sync() or use a callback with .callback(this) to be notified when it finishes loading.

GerhardPue commented 9 years ago

.sync() didn't exist! and .callback(this) gets a error like " callback (com.pkmmte.pkrss.Callback) in RequestCreater cannot be applied to (com.app.myapp.RssService)

code : PkRSS.with(this).load(RSS_URL).callback(this).async();

and if i only use PkRSS.with(this).load(RSS_FUTURE); the same error // articleList null

Pkmmte commented 9 years ago

I see you're not familiar with interfaces. When you pass "this" as your callback, it implies that your class implements the necessary interface (in this case, com.pkmmte.pkrss.callback).

If you're using Android Studio, pressing Alt + Enter with the error selected will bring up an option to automatically implement the interface for you. If you'd like shorter code, you can do it like this:

.callback(new Callback() { // Overriden stuff here })