1

I have an android app that lists items with url links and on clicking opens the pages using uri,

as below

String url = "http://www.example.com";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);

I would like to open only for example a video or image in that page but not the whole of it. Is that possible in android?

2 Answers2

1

I got what you want to ask. NO, it is not possible with Intent to open a part of a webpage, it will open entire page, I suggest you to 1. download and save the image to your drawable folder. 2. create a new actvity , and in the xml associated with that activity add a imageview 3. place your image in that imageview 4. and on the click of the link start the activity with the intent

Raj
  • 946
  • 12
  • 16
0

I would suggest to either use an ImageView (load the image into it - Download image for imageview on Android) or a VideoView (as stream - http://code.tutsplus.com/tutorials/streaming-video-in-android-apps--cms-19888).

It's not possible with an intent.

Community
  • 1
  • 1
Lukas
  • 2,544
  • 2
  • 18
  • 33