在Intent上找不到源代码

时间:2011-08-31 09:24:39

标签: android

我在这一行找不到来源:

Intent intent = new Intent(NewsActivity.this, WebActivity.class);

我的代码是:

public class NewsActivity  extends ListActivity {

 public ReadXML ReadXML=new ReadXML();
 public  ArrayList<String> ynetList =new ArrayList<String>();

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);

for(int i=0;i<ReadXML.hadashotListItems.size();i++)
ynetList.add(ReadXML.hadashotListItems.get(i).title+"\n"+ReadXML.hadashotListItems.get(i).pubDate);

      setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, ynetList));

      View v=getListView() ;

      ListView lv = getListView();
      lv.setTextFilterEnabled(true);

      lv.setOnItemClickListener(new OnItemClickListener() {
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

               // When clicked, show a toast with the TextView text
               String s = ReadXML.hadashotListItems.get(position).link;

               Intent intent = new Intent(NewsActivity.this, WebActivity.class);
               intent.putExtra("url", s);

               startActivity(intent);

            }


      }

并且WebActivity的代码是:

public class WebActivity extends Activity {  
    @Override  
    public void onCreate(Bundle savedInstanceState) {  
        super.onCreate(savedInstanceState);
        setContentView(R.layout.webview);  
        WebView mWebView;

        mWebView = (WebView) findViewById(R.id.webview);
        mWebView.getSettings().setJavaScriptEnabled(true);
        mWebView.loadUrl("http://www.google.com");


    }  
}

在我的代码中,我只想加载一个url链接。

感谢您的帮助。

0 个答案:

没有答案