2012-09-20 25 views

回答

0

要打開瀏覽器,你可以簡單地推出如下活動:

Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.dtcsearch.com")); 
startActivity(i); 

但要填寫網頁上的搜索框,您還需要修改您的網頁以納入/支持此要求。例如,您需要將搜索字符串放入URL中,然後修改您的網頁以通過GET方法讀取url內容,並在文本框中填入提供的搜索字符串。

Intent i = new Intent(Intent.ACTION_VIEW, 
      Uri.parse("http://www.dtcsearch.com/?s=hello")); 
startActivity(i); 

和網頁(假設它寫在PHP

$strSearch = $_GET["s"]; //should return 'hello' 

最後,使用$strSearch填寫網頁上搜索文本框。

相關問題