您的位置:首页 > 移动开发 > Android开发

Android中链接到百度进行搜索

2013-04-20 15:02 218 查看
String st = et.getText().toString();
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 it = new Intent(Intent.ACTION_VIEW, uri); 
Timer timer = new Timer();  
TimerTask task = new TimerTask() {  
       @Override  
       public void run() {  
        startActivity(it); 
        }  
      };  
      timer.schedule(task, 0);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: