0

I am new with android development.I am creating an app that will tell the meaning of name entered by user, for this I am using www.babynamesworld.parentsconnect.com to fetch the data and parse the meaning of name out of it.Here is the code but it doesn't seem to work.

Button b=(Button)findViewById(R.id.button1);

        b.setOnClickListener(new Button.OnClickListener() 
        {

            TextView tv=(TextView)findViewById(R.id.textView1);

            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub

                try {
                    EditText et=(EditText)findViewById(R.id.editText1);
                    Document document = Jsoup.connect("http://babynamesworld.parentsconnect.com/meaning_of_"+et.getText().toString()+".html").get();
                    Element firstMeta = document.select("meta").first();
                     String title = firstMeta.attr("DESCRIPTION"); 
                     tv.setText(title);
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }


        }});



    }

As soon I click on the button, program crashes. I've added internet access permission too.

Abhi
  • 8,935
  • 7
  • 37
  • 60

1 Answers1

0

It looks like the Virtual Machine can't find the Jsoup class definitions. Have you included either the source files or a jar in your project?

If you've already added the jar try cleaning the project.

slayton
  • 20,123
  • 10
  • 60
  • 89
  • yes I've included jsoup.jar through Project>Properties>Java Buil Path>Libraries>Add External Jars Do I need to do anything else? – pramod jodhani Apr 10 '12 at 14:10
  • If you using the newest version (ADT r17) you have to choose antoher way to add the lib to your project. Look here [Adding lib in r17](http://stackoverflow.com/questions/10046298/android-update-17-seems-incompatible-with-external-jars) – sandkasten Apr 10 '12 at 15:12
  • @sandkasten already solved the problem, cleaning worked, thanks anyways – pramod jodhani Apr 10 '12 at 15:15