2017-02-27 23 views
-1

私のコードは次のとおりです。エラーのHTML構文解析とonPostExecute

CikmisSorular.java:

class CikmisSorular extends AsyncTask<Void,Void,Void> 
{ 
    String URL="http://www.utercih.com/rehberlik.aspx"; 
    String aciklama; 
    String veri; 
    ProgressDialog dialog; 
    TextView txtWeb; 
    Context mContext; 

    CikmisSorular(Context c){ 
     this.mContext = c; 
    } 

    @Override 
    protected void onPreExecute() 
    { 
     super.onPreExecute(); 
     dialog=new ProgressDialog(mContext); 
     dialog.setTitle("Jsoup Uygulama."); 
     dialog.setMessage("Veri getiriliyor"); 
     dialog.setIndeterminate(false); 
     dialog.show(); 
    } 

    @Override 
    protected Void doInBackground(Void... params) { 
     try { 
      Document doc= Jsoup.connect(URL).get();//Siteye bağlantı sağlanıyor. 
      Elements elements=doc.select("div[class=detayici]");//div tagına ait attiribute çağrılıp Element sınfının içerisindeki nesneye aktarılıyor. 

      veri=elements.html();//istenilen html taglarını çeker. 
      aciklama=Jsoup.parse(veri).text();//html taglarını texte çevirir. 
     } catch (IOException e) { 
      e.printStackTrace(); 
     } 
     return null; 
    } 

    @Override 
    protected void onPostExecute(Void avoid) 
    { 
     TextView txtWeb1=(TextView)findViewById(R.id.tv_jsoup); 
     txtWeb1.setText(aciklama); 
     dialog.dismiss(); 
    } 
} 

私はエラーを取得しています:onPostExecute()法上の

Cannot resolve method 'findViewById(int)'

を。

アドバイスはありますか? onPostExecute

答えて

0

書き込みこの:

TextView txtWeb1 = (TextView)((Activity)mContext).getWindow().getDecorView().findViewById(android.R.id.tv_jsoup); 
関連する問題