Android Filter URL in "Aim Filter"

I am developing an image upload application. I successfully launch my application when the user clicks the link to download the image. How can I filter a specific URL?

here is my manifest code:

<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> 

my application will launch and download the image when the user clicks on any link in the browser, but does not launch it at a specific URL, for example, "http://www.ABC.com" or a specific element "http://www.ABC. com / image / background.jpg "

+6
source share
3 answers

when your application requires an image download, you should examine the link:

  Intent intent = getIntent(); String link = intent.getDataString(); 
+7
source

See other useful attributes (pathPattern, pathPrefix) of the data tag here: http://developer.android.com/guide/topics/manifest/data-element.html .

+2
source

A simple example: get the URL from the intent filter:

 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()); } } 
+1
source

Source: https://habr.com/ru/post/894086/


All Articles