public class Main extends Activity {
TextView liste1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
new Ara1().execute();
}
public class Ara1 extends AsyncTask<Void,Void,String> {
ProgressDialog dialog = new ProgressDialog(Main.this);
@Override
protected String doInBackground(Void... arg0) {
// TODO Auto-generated method stub
int i;
String result = "";
try {
Document document = Jsoup.connect("http://www.bilyoner.com/iddaa/hazir-kupon-detay?yazar=populer").get();
Elements element = document.select("li.iddaaTabsTab");
if (element.size() > 0) {
int x = element.size();
for (i = 0; i < x ; i++) {
result = result + element.get(i).text();
}
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return result;
}
@Override
protected void onPostExecute(String result) {
// TODO Auto-generated method stub
super.onPostExecute(result);
liste1 = (TextView)findViewById(R.id.tv);
liste1.setText(result);
dialog.dismiss();
}
@Override
protected void onPreExecute() {
// TODO Auto-generated method stub
super.onPreExecute();
dialog.setMessage("Aranıyor...");
dialog.show();
}
}
When i connect this website " http://www.bilyoner.com/iddaa/hazir-kupon-detay?yazar=populer " and trying to parse, there is a problem that i couldnt get any data. I tried Jsoup on wikipedia and works great.
Also when i try this site on try jsoup it seems works without any problem.
Any help would be greatly appreciated.
Your code is working perfect so it seems it's a problem of your android settings.
there is a problem
Can you give as some more details (eg. stacktrace, error message, ...) about that? Without it's realy hard to say whats your problem.
Please also read my answers here: Getting table row text from url
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.