ajjumma
ajjumma

Reputation: 103

Can't use Document in jsoup

I'm trying to use jsoup to parse HTML to my android app. but It seems the error occur at Document.

"Document cannot be resolved to be a type"

"Jsoup cannot be resolved"

Could anyone help me solve this? because I've not found the way to solve it.

import java.net.URL;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.activity_main, menu);
    return true;
}

URL url = new URL("http://google.com");
Document document = Jsoup.parse(url, 5000);

}

Upvotes: 0

Views: 1509

Answers (1)

wtsang02
wtsang02

Reputation: 18863

"Jsoup cannot be resolved"

Because you didn't import the library properly. You have to make a lib folder put the .jar in the folder then, add the build path.

Upvotes: 2

Related Questions