我從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;
}