Facebook like share in android EditText - android

Good day.I want to create an share field like facebook.In the facebook if you insert an link it will automatically get the lets say 'short preview' of your link with an title and image.I dont think that facebook got in touch with whole wordls website databses so it gather them from databases but rather parsing the url somehow.Anyway lets imagine i have an edittext with user letting input some ulr.How can i achieve this kind of technique?By googling i did not find anything closer to what i want.

Facebook downloads the url and displays the title in the header and a few lines of text. A prominent image on the page if it finds one. You'd have to do something similar- download the url, parse the html, and grab enough info to make your preview.

Most of the websites have og(Open Graph) tags in them. Check out the Facebook Open Graphs Website to understand more about these tags. You can fetch data corresponding to these tags and that is what most social media sites and WhatsApp do to provide a preview.

Related

Converting PDF to text and reading it from android

I am currently working on an android application that will allow people to read the constitution, issue is I have only managed to get my hands on a soft copy pdf document. Ideally, I wanted an API that would allow me to fetch the document by Topic, issue or paragraph, I thought of multiple ways of getting the job done
1. Is by putting the document on the server, when user opens the app it downloads the pdf and allows them to read it(Problem with this is I won't be able to mess with the content like bold some text etc).
2. Is copying the content of the pdf into the databse and just fetching the text with a query(issue with this is I wont be able to do pagination given I put the content in one field)
Here is the link to the Constitution I needed a way in which I can load the data from the database in a way that I will be able to paginate, load a single paragraph or topic at a time. Can anyone whose been in a similar situation help me figure out the best way possible.
You don't to convert it to text, you can integrate MuPdf in your application check this answer I've found integrating pdf reader

How to display article with rich media: text, image, youtube, soundcloud etc

Im making an app that will have articles, an article can have text, image, youtube, soundcloud etc.
I want to be able to do that easy and without a lot of code like having to copy and paste the url.
Im thinking this approach:
Having the app to use a Parse.com Server
set the App database to something like this: article id, title,
category, text, image-1, image-2, youtube-1, youtube-2, soundcloud-1 etc
and display the article in this way:
upload the image youtube url etx to the server and then in the text field use placeholder to display my rich media.
For example this text:
[image-1]Hello world [youtube-1]
Will be converted on the fly to a relative layout that will have first an Imageview, below the imageview a Textview, below the textview, a youtube video.
Is this the best way to do what i want? is another better way to do something like this?
WebView and Wordpress is the way to go after a research.
Now that Wordpress has REST API you have a superb writer and a blog for your sites and you can fetch them. I really think is the best and simpler solution.

Android - share both text and image to WhatsApp same as YouTube share function

I have been searching for a way to create a share function that share an image and text in the same time and the answers i found is that WhatsApp can only share a single text or single image or single audio .. but in another hand i found that YouTube application is able to share text and image in the same time and in one message box as shown below:
So is anyone have an idea of how to do this?!.
And thank you in advance.
WhatsApp actually recognize this link as a youtube link and gets the preview image of the video from youtube.
WhatsApp and youtube probably made an arrangement between them, when WhatsApp recognize
a youtube link it request the image from youtube servers and gets it.
You can see that if you take only the link and send it, the image will be added by WhatsApp.
unfortunately there is no way (that i know off) to share both an image and a text in WhatsApp.
Regards,
Gili
Checking the answer from Gili, what I found out is the link that YouTube share has the follow format in the Extra Text:
https://youtu.be/prkQ6QFv-_Y
So, it is quite easy to parse it and by using the YouTube API for Java, it is possible to retrieve almost all the possible information about that video and build your own layout.
Link one: How to register your app for YouTube to share the text and
capture it:
http://developer.android.com/training/sharing/receive.html
Link two: YouTube Data API for Java
https://developers.google.com/api-client-library/java/apis/youtube/v3
What I am not sure if all the version of YouTube shared text has the same format or not.

GrabURL from Website table

Hi Guys I Want to Grab an URL from a site the page only has one or many URL link on it, I would like to connect to the site URL and grab the link fro inside the page And put that in a string, Can It be done? I want to do it in android. Excuse me If this is a simple question Is that I really don't know how to do it, I have done researched but I am confused.
I want to grab this page
http://nightlies.videolan.org/build/win64/last/
It's Vlc, There are 6 Links and they are constantly updated, How can I get the urls and put them each on a string on My activity?, I want to fetch the links when the app is loaded so It gets the links as they are changing from day to day.
Thanks
You need an HTML Parser like JSoup: http://jsoup.org/.

How to get image name from website?

I've not been successful in searching for this answer, but basically, how can I find the image file name from a website that blocks saving of the images? Normally, the url source will have the image filename and it is easily searchable.
However, some sites lets you hover over the picture and it then zooms to a larger image. The source shows,
for example,
http://example.com/pictures.aspx?ImagePath=ABCDEFGHIJ1234567989KLMNOPQRST==.....
E.g.: A random long string of code, but no .jpg or .png indicating the file name. When right clicking to save, it shows the image is blocked.
How can I get the images using Android code?
Tks
If it's not allowing them to be taken from a website, then it probably shouldn't be taken. That being said, there are a couple of options if you are the owner of the website.
If they are in a database then you can get the url address of them. Also, right clicking anywhere on the page to "View source" should get you some sort of URL of the image.
This seems more of a web service implementation issue rather than anything andriod specific. Many websites have this feature where you are not meant to retrieve information from the url.
However there should be a corresponding supported web service interface for fetching the metadata of a particular resource. If this is not supported then it's meant to be blocked.
The other trial and error sort of way is to invoke a 3rd party API like oEmbed (or Embed.ly : http://embed.ly/) that would return the metadata of the resource for which you have the URL. These services cover a wide range of websites and their resources.
You can search around in their site or find similar such services that would get you this information. Embed.ly is more of a personal preference due to its exhaustive list of supported sites.

Categories

Resources