Skip to content

Commit 10d4842

Browse files
author
Rohit Singh
committed
- Documentation updated for better understanding
1 parent ddd7f89 commit 10d4842

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

README.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,38 @@
33
An Android Project with demo application, to fetch meta-data from url, like facebook, youtube and other websites.
44

55
# Usage
6+
You can check out the sample project. Following libs is added for parsing the URL
7+
8+
Add the Jsoup dependency - Jsoup is an open-source Java library designed to parse, extract, and manipulate data stored in HTML documents.
9+
10+
dependencies {
11+
implementation 'org.jsoup:jsoup:1.15.2'
12+
}
13+
14+
### If using ProGuard add this line to your proguard-rules.pro:
15+
16+
-keep public class org.jsoup.** {
17+
public *;
18+
}
19+
20+
> if you want to set obtained meta data to view
21+
~~~java
22+
mBinding.idLinkPreview.parseTextForLink(mBinding.edtLink.text.toString())
23+
~~~
24+
25+
> Set your own CickListener
26+
27+
~~~java
28+
//set your own click listener
29+
mBinding.idLinkPreview.loadListener = object : LinkListener {
30+
override fun onError() {
31+
Toast.makeText(this@MainActivity,"Error on Preview link",Toast.LENGTH_SHORT).show()
32+
}
33+
34+
override fun onSuccess(link: PreviewData) {
35+
// do your stuff
36+
}
37+
}
38+
~~~
639

7-
Request metadata for url, it will execute in background thread, you will get an instance from LinkPreview
840

0 commit comments

Comments
 (0)