1

I am adding a context menu for Browser using intent filters. My custom menu item is visible under Share page option. Now on menu click I need to capture the web page content and upload to server. I am not able to capture the web page content. Please let me know if we can capture the web page content.

Thanks, Mamatha

user778935
  • 81
  • 1
  • 6

2 Answers2

1

You get the URL to be shared, right? If so, do a HTTP GET request to fetch the actual page: http://developer.android.com/reference/org/apache/http/client/methods/HttpGet.html

Stefan H Singer
  • 5,469
  • 2
  • 25
  • 26
  • No, I am not able to capture the url to be shared also.If I can get the url address then I can content using HTTP get request as suggested by you. I am using Intents to get the url addr/content but the Bundle object returned has values android.intent.extra.TEXT,android.intent.extra.SUBJECT,share_favicon,share_screenshot and are returned as null – user778935 Jun 24 '11 at 05:46
  • Are you fetching the data using getStringExtra? See this: http://stackoverflow.com/questions/6413822/how-do-i-receive-a-share-url-from-browser – Stefan H Singer Jun 27 '11 at 07:00
  • Thanks for the reply. I could capture the url using getStringExtra() method. I am getting the web page content using http connection. But the problem is that I am unable to get the images. I am reading the stream and uploading to server. But, the uploaded html page does not display the images.I have tried changing the MIME type but no luck. We have placed the MIME type as "text/plain" in manifest file for adding the custom menu item is that the reason that the web page content being read is jus plain text? – user778935 Jul 04 '11 at 09:35
  • That seems to be a separate question? Are you also downloading and hosting all images? Are the image URLs relative or absolute? You should probably mark this question as closed (since you know can fetch the page content) and formulate a new one for the new issue. – Stefan H Singer Jul 04 '11 at 13:55
0

But you know the URL that is to be shared.

So, look at this answer here.

I believe you know how to read from an InputStream in Java, but here's a good question, in any case.

Community
  • 1
  • 1
alkar
  • 5,459
  • 7
  • 27
  • 43