Android中链接到百度进行搜索

String st = editText.getText().toString().trim();
Uri uri = null;
try {
  uri = Uri.parse("http://www.baidu.com/s?&ie=utf-8&oe=UTF-8&wd=" + URLEncoder.encode(st, "UTF-8"));
} catch (UnsupportedEncodingException e1) {
  e1.printStackTrace();
}
final Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
intent.setData(uri);
Timer timer = new Timer();
TimerTask task = new TimerTask() {
  @Override
  public void run() {
    startActivity(intent);
  }
};
timer.schedule(task, 0);

 

 

 

 

posted @ 2013-03-08 21:36  Duelsol  阅读(641)  评论(0编辑  收藏  举报