protected Void doInBackground(Void... params) {
try {
doc = Jsoup.connect(url).get();
linksOnPage = doc.select("h2.filmibeat-myshow-movie > a[href][title]");
}catch (Exception e){
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
//Log.e("Value", txt);
for(Element link : linksOnPage) {
//Log.e("fsdsd", link.attr("title"));
if (link.attr("title").contains(txt)) { // The search I tried
final Toast toast = Toast.makeText(MainActivity.this,"YO",Toast.LENGTH_SHORT);
toast.show();
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
toast.cancel();
}
},1000);
}
}
}
包含(txt)方法并不总是适用于所有输入,我总是得到一个" NO"敬酒。我想检查网页中是否存在输入txt。请帮助!