我从Web服务器(如文章desc,日期,标题等)获取动态值。对于一个值文章ID,desc显示在一个webview中。我正在使用webview数组。我的要求是,如果用户点击第一个网页视图,我必须将第一个文章ID传递给另一个活动。如何将值的数组传递给Android中的另一个活动
任何人都可以告诉我如何将数组值传递给另一个活动?
有人可以举个例子吗?
此代码解释了我从webservice获取值并存储在arraylist中,并迭代数组列表并在webview中显示并实现触摸事件。我的要求是,如果用户触摸第一个视图。我必须通过第一个文章ID到另一个活动可以告诉如何做到这一点?
ArrayList articleParsedValue=new ArrayList();
articleParsedValue=articleParser.parseXmlArticle(webservicevalue);
for(int i=0;i<articleParsedValue.size();i++)
{
ArticleDataSet articleDataset=(ArticleDataSet)articleParsedValue.get(i);
HashMap<String, String> mapValue=new HashMap<String, String>();
WebView webviewcontent=new WebView(this);
String html ="<html><body><div><label style=\"font:bold 17.5px verdana; color:#C1002B\">"+articleDataset.getArticle_title()+"<label style=\"font:13px verdana; color:#000000\">"+"|"+"</label>"+"<label style=\"font:bold 13px verdana; color:#000000\">"+articleDataset.getArticle_type()+"</label><br><label style=\"font:13px verdana; color:#AAAAAA\">"+articleDataset.getArticle_date()+" </label> </div>";
html=html+"<div><label style=\"font:13px verdana; color:#000000\">"+articleDataset.getArticle_summary()+"</label></div></body></html>" ;
webviewcontent.getSettings().setJavaScriptEnabled(true);
webviewcontent.clearCache(true);
webviewcontent.loadData(html, "text/html", "utf-8");
webviewcontent.setOnTouchListener(this);
mainlinear2.addView(webviewcontent);
}
@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
{
Intent newIntent=new Intent(this,MyCompaniesActivity.class);
//newIntent.putExtra("articleid",);
startActivity(newIntent);
return false;
}