android过滤器url在“中”;意向过滤器“;
我正在开发一个下载图像的应用程序。当用户单击下载图像链接时,我已成功触发我的应用程序。如何筛选特定URL 这是我的舱单代码:android过滤器url在“中”;意向过滤器“;,android,android-manifest,intentfilter,Android,Android Manifest,Intentfilter,我正在开发一个下载图像的应用程序。当用户单击下载图像链接时,我已成功触发我的应用程序。如何筛选特定URL 这是我的舱单代码: <activity android:theme="@style/Transparent" android:name=".DownloadImage" android:label="@string/app_name"> <intent-filter> <action android:nam
<activity android:theme="@style/Transparent" android:name=".DownloadImage"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:mimeType="image/*" android:host="*"
android:scheme="http" />
</intent-filter>
</activity>
我的应用程序将在用户单击浏览器中的任何链接时启动并下载图像,但不会触发特定url,例如“http://www.ABC.com“或特定项目”http://www.ABC.com/image/background.jpg“当应用程序要求下载图像时,您应该浏览以下链接:
Intent intent = getIntent();
String link = intent.getDataString();
请参见此处数据标记的其他有用属性(pathPattern、pathPrefix): 从意图过滤器获取url的简单示例:
public class openUrl extends Activity{
String link;
TextView text;
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.xmlname);
Intent intent = getIntent();
link = intent.getDataString();
text = (TextView)findViewById(R.id.textViewId);
text.setText(link.toString());
}
}
@欢迎来到StackOverflow,这是一个很好的答案,但是对于更多的投票,你能用问题中的具体例子来扩展一下吗?所以我更愿意有更完整的答案,而不仅仅是链接,谢谢。顺便说一句,这里有一个关于