【问题标题】:Start intent to open google link just like the I am feeling lucky button开始意图打开谷歌链接,就像我感觉很幸运按钮一样
【发布时间】:2012-04-10 18:53:07
【问题描述】:

我的活动中有一个按钮,我希望在按下时触发一个意图,该意图将启动某个页面,就像谷歌上的“我感觉很幸运”一样

意思是这样的

public void startIntent(String textToSearch){
//fire an intent that will open the page just like when I open
//google.com and enter the textToSearch text and press I am feeling lucky
}

我该怎么做?

【问题讨论】:

标签: android android-intent


【解决方案1】:

这是我需要的

public void startIntent(String textToSearch){
Uri uri = Uri.parse("http://www.google.com/#q="+textToSearch);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-12-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多