웹 사이트의 일부 데이터를 활동에 표시하려는 응용 프로그램을 개발 중입니다. 이를 위해 Jsoup를 사용하여 데이터를 구문 분석합니다. 하지만 난에 오류가 점점 오전 : 여기android에서 Jsoup를 사용하여 웹 사이트의 데이터를 구문 분석하는 방법
org.jsoup.nodes.Document document = Jsoup.connect(url).get();
그 것이다 아래, 나는 내가 뭘 잘못이 무엇인지에 대한 생각을 못하고 있어요 내 전체 코드 ...
import java.io.IOException;
import org.jsoup.Jsoup;
import org.jsoup.select.Elements;
import android.os.AsyncTask;
import android.os.Bundle;
import android.provider.DocumentsContract.Document;
import android.app.Activity;
import android.view.Menu;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.TextView;
public class Events extends Activity
{
//WebView web1;
TextView t1;
String url="https://sites.google.com/site/holyfamilychurchpestomsagar/notices-for-the-week";
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_events);
t1=(TextView)findViewById(R.id.textView1);
Title t2=new Title();
t2.execute();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.events, menu);
return true;
}
private class Title extends AsyncTask<Void, Void, Void> {
Elements title;
String desc;
@Override
protected void onPreExecute()
{
super.onPreExecute();
}
@Override
protected Void doInBackground(Void... params) {
try {
// Connect to the web site
org.jsoup.nodes.Document document = Jsoup.connect(url).get();
// Get the html document title
title = document.select("meta[name=title]");
desc = title.attr("content");
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void result)
{
// Set title into TextView
t1.setText(desc);
}
}
}
내 앱이 충돌하는 중 ... !!! – Ruchir