0%

android开发之启动Android market并搜索

为了推广其他软件,可以使用这个功能,当用户点击“更多软件”时,自动打开market,并搜索指定作者或指定名字的软件。 首先在AndroidManifest.xml加入以下代码:

<intent-filter>    
    <action android:name="android.intent.action.VIEW" />    
    <category android:name="android.intent.category.DEFAULT" />    
    <data android:scheme="market" android:host="search" />    
</intent-filter> 

在程序执行的地方加上下面一句:

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pub:Droidwork2010"))); 

这里是搜索发布者Droidwork2010的全部软件