开发者

source not found on Intent

I am getting source not found on this line:

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

My code is:

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开发者_StackOverflow.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);

            }


      }

and the code for WebActivity is:

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");


    }  
}

In my code I just want to load a url link.

Thanks for helping.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜