K
K
Kirill Yaroshevich2017-01-14 18:22:21
Android
Kirill Yaroshevich, 2017-01-14 18:22:21

Cannot find symbol method execute. How to decide?

Help decide. I'm parsing the site.
1. error :

Error:(30,21) error: cannot find symbol method execute()

2. error :
Error:(35, 9) error: method does not override or implement a method from a supertype

3. error :
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

package com.yarashevich.kiryl.test;

import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import java.io.IOException;
import java.util.ArrayList;

public class Test_news extends Activity {

    public Elements content;
    public ArrayList<String> titleList = new ArrayList<String>();
    private ArrayAdapter<String> adapter;
    private ListView lv;

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

        lv = (ListView) findViewById(R.id.pro_item);
        new Thread().execute();
        adapter = new ArrayAdapter<String>(this, R.layout.list_item, R.id.pro_item, titleList);
    }

    public class NewThread extends AsyncTask<String, Void, String> {
        @Override
        protected String doInBackround(String... arg) {
            Document doc;
            try {
                doc = Jsoup.connect("http://www.uoipd.by/ru/").get();
                content = doc.select(".main_content");
                titleList.clear();
                for (Element contents: content) {
                    titleList.add(contents.text());
                }
            } catch (IOException e){
                e.printStackTrace();
            }
            return null;
        }

        @Override
        protected void OnPostExecute(String result) {
            lv.setAdapter(adapter);
        }

        @Override
        protected String doInBackground(String... strings) {
            return null;
        }
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
one pavel, 2017-01-14
@onepavel

new Thread().execute() не тоже самое, что new NewThread().execute();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question