安卓外部/第三方应用调用MOJI搜索

[java]
public void startSearch(View view) {
Intent intent = new Intent(Intent.ACTION_SEARCH);
// 以下两种方式都可以
intent.putExtra(Intent.EXTRA_TEXT, “Dog”);
intent.putExtra(SearchManager.QUERY, “Dog”);
startActivity(intent);
}

<intent-filter>
<action android:name=”android.intent.action.SEARCH”/>
<category android:name=”android.intent.category.DEFAULT” />
</intent-filter>

public void startWebSearch(View view) {
Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
// 以下两种方式都可以
intent.putExtra(Intent.EXTRA_TEXT, “Dog”);
intent.putExtra(SearchManager.QUERY, “Dog”);
startActivity(intent);
}

<intent-filter>
<action android:name=”android.intent.action.WEB_SEARCH”/>
<category android:name=”android.intent.category.DEFAULT” />
</intent-filter>

public void startShow(View view) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.putExtra(Intent.EXTRA_TEXT, “Dog”);
intent.setType(“text/*”);
startActivity(intent);
}

<intent-filter
tools:ignore=”AppLinkUrlError”>
<action android:name=”android.intent.action.VIEW”/>
<category android:name=”android.intent.category.DEFAULT” />
<data android:mimeType=”text/*”/>
</intent-filter>

public void startSend(View view) {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_TEXT, “Dog”);
intent.setType(“text/*”);
startActivity(intent);
}

<intent-filter>
<action android:name=”android.intent.action.SEND”/>
<category android:name=”android.intent.category.DEFAULT” />
<data android:mimeType=”text/*”/>
</intent-filter>
[/java]