I'm trying to understand开发者_如何学Go Google's example of XML Adapters as shown at http://developer.android.com/resources/samples/XmlAdapters/index.html, especially as it related to RSS feeds.
I cannot get Google's sample code to compile. The Adapters.java code seems to have several issues with undefined variables, mContext
, mFrom
, and mTo
as used in the XmlCursorAdapter
class.
I am new to Android and am trying to get this to work with a API level 4 program.
Has anyone gotten this example to work? Can you offer any insight?
ArrayAdapter<RssItem> adapter = new
ArrayAdapter<RssItem>(this,R.layout.style,feed1.getAllItems());
itemlist.setAdapter(adapter);
itemlist.setOnItemClickListener(this);
itemlist.setSelection(0);
just try this example
You can find the complete source code of the examples also in the android sdk-samples. There is also an upated version of the XmlAdapters sample for SDK-version 15.
However, I can get it to compile, but it does not run afterwards, but I assume that's due to a configuration issue on my side. You should have a look into the source code which comes delivered right with the sdk. They can be installed via the Android SDK Manager.
精彩评论