- 전체
- android studio
- Android SDK
- Android NDK
- Android ADK
- Android Etc. Lib.
- Android dalvik VM
- Android 보안
- PhoneGap
- AOSP 개발
- MIT App Inventor 2
- kivy (python)
- ionic framework
- Kotlin (코틀린)
- React Native
Android SDK Android Basic JSOUP Tutorial
2017.03.27 15:27
Android Basic JSOUP Tutorial
In this tutorial, you will learn how to implement JSOUP open source java library in your Android application. JSOUP provides a very convenient API for extracting and manipulating data, using DOM, CSS, and jquery-like methods. JSOUP allows you to scrape and parse HTML from a URL, file, or string and many more. We will create 3 buttons on the main view and each button will perform different tasks such as showing the website title, description and a logo. So lets begin…
Before you proceed with this tutorial, download the latest JSOUP library from here.
Paste your downloaded Jsoup file into your project libs folder as shown on the image below.

Create a new project in Eclipse File > New > Android Application Project. Fill in the details and name your project JsoupTutorial.
Application Name : JsoupTutorial
Project Name : JsoupTutorial
Package Name : com.androidbegin.jsouptutorial
Open your MainActivity.java and paste the following code.
MainActivity.java
In this activity, we have created three buttons that response to three different AsyncTask. Before I proceed with further explanation, see the steps below on how to get the html source codes from a website.
Step 1 : Visit http://www.androidbegin.com with any preferred Internet browser on your PC

Step 2 : Right-Click on an open space and select “View page source”

Step 3 : Website source codes

A website source code determines how your webpages should appear. However, source code of a web page will only display information and code that is not processed by the server.
The first button retrieves the website title. This is a way to get the page title.
Java Code
Website Source Code
The second button retrieves the website description. By using Elements, we are able to specify the exact location of the data.
Java Code
Website Source Code
The third button retrieves the website logo. By using Elements, we are able to specify the exact location of the data.
Java Code
Website Source Code
Next, create an XML graphical layout for the MainActivity. Go to res > layout > Right Click on layout > New > Android XML File
Name your new XML file activity_main.xml and paste the following code.
activity_main.xml
Next, change the application name and texts. Open your strings.xml in your res > values folder and paste the following code.
strings.xml
In your AndroidManifest.xml, we need to declare permissions to allow the application to connect to the Internet. Open your AndroidManifest.xml and paste the following code.
AndroidManifest.xml
Output:

Source Code
[출처] http://www.androidbegin.com/tutorial/android-basic-jsoup-tutorial/
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
댓글 0
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
|---|---|---|---|---|
| 13 |
빠르게배우는 안드로이드 Fragment-4(Fragment간 에 데이터전달)
| 졸리운_곰 | 2020.09.19 | 155 |
| 12 |
빠르게배우는 안드로이드 Fragment-3(Fragment기초 실습)
| 졸리운_곰 | 2020.09.19 | 209 |
| 11 | 빠르게배우는 안드로이드 Fragment-2(Activity-> Fragment로 쉽게 변경) | 졸리운_곰 | 2020.09.19 | 236 |
| 10 |
빠르게배우는 안드로이드 Fragment -1 (배경)
| 졸리운_곰 | 2020.09.19 | 194 |
| 9 |
안드로이드 스튜디오 - 새로 생성한 Activity Class를 쉽게 Manifest에 등록하기.
| 졸리운_곰 | 2020.08.08 | 252 |
| 8 |
Android Studio Build시 failed linking references 해결방법
| 졸리운_곰 | 2020.05.05 | 648 |
| 7 |
[안드로이드 스튜디오] COULD NOT FIND COM.ANDROID.TOOLS.BUILD:GRADLE:3.0.0-BETA6
| 졸리운_곰 | 2020.05.05 | 125 |
| 6 |
Android Sync SQLite Database with Server using PHP and MySQL
| 졸리운_곰 | 2019.02.25 | 7762 |
| 5 |
안드로이드의 MVC, MVP, MVVM 종합 안내서
| 졸리운_곰 | 2019.01.06 | 370 |
| 4 |
Getting Started: WebView-based Applications for Web Developers
| 졸리운_곰 | 2018.09.03 | 410 |
| 3 |
Android Asynchronous Http Client
| 졸리운_곰 | 2017.07.03 | 709 |
| 2 |
android studio 2.3 의 안드로이드 레이아웃 배치 법 : Layout Editor로 UI 빌드
| 졸리운_곰 | 2017.03.09 | 534 |
| 1 |
Android Studio 2.2에서 Layout Preview 한글 깨짐 현상 해결 방법
| 졸리운_곰 | 2017.03.08 | 568 |

