嗨 我已经建立了一个rss阅读器,并在ibm tutorial.I的帮助下创建了它的所有类,我给了以下URL“http://www.mahindrasatyam.com/rss/rssfeeds/news_updates.xml” 。有rss供稿的 。 我想获得每个文章的点击列表中的项目的描述。 对于该代码 是如何开始另一项活动?
public void onItemClick(AdapterView parent, View v, int position, long id)
{
Log.i(tag,"item clicked! [" + feed.getItem(position).getTitle() + "]");
Intent itemintent = new Intent(this,ShowDescription.class);
Bundle b = new Bundle();
b.putString("title", feed.getItem(position).getTitle());
b.putString("description", feed.getItem(position).getDescription());
b.putString("link", feed.getItem(position).getLink());
b.putString("pubdate", feed.getItem(position).getPubDate());
itemintent.putExtra("android.intent.extra.INTENT", b);
startSubActivity(itemintent,0);
}
但它示出了一个错误startSubActivity(itemintent,0);
并去除错误需要o实施其方法,它是
private void startSubActivity(Intent itemintent, int i) {
// TODO Auto-generated method stub
}
我想与类显示说明这是
public class ShowDescription extends Activity
{
public void onCreate(Bundle icicle)
{
super.onCreate(icicle);
setContentView(R.layout.showdescription);
String theStory = null;
Intent startingIntent = getIntent();
if (startingIntent != null)
{
Bundle b = startingIntent.getBundleExtra("android.intent.extra.INTENT");
if (b == null)
{
theStory = "bad bundle?";
}
else
{
theStory = b.getString("title") + "\n\n" + b.getString("pubdate") + "\n\n" + b.getString("description").replace('\n',' ') + "\n\nMore information:\n" + b.getString("link");
}
}
else
{
theStory = "Information Not Found.";
}
TextView db= (TextView) findViewById(R.id.storybox);
db.setText(theStory);
Button backbutton = (Button) findViewById(R.id.back);
backbutton.setOnClickListener(new Button.OnClickListener()
{
public void onClick(View v)
{
finish();
}
});
}
}
加载的描述,但没有装上图点击列表项的
能有人帮我解决这个问题
包含'}};''的行在setOnClickListener中看起来不正确。平衡括号在“新”之前,整个事情看起来极端可疑。 – 2011-05-26 09:49:36