Advertisement
Guest User

Untitled

a guest
Jul 16th, 2016
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. public class NewThread extends AsyncTask<String, Void, String>{
  2.  
  3. Document doc;
  4. @Override
  5. protected String doInBackground(String... params) {
  6. try{
  7. doc = Jsoup.connect("****************").get();
  8. content = doc.select(".entry-header");
  9. hello.clear();
  10. for(Element contents: content){
  11. hello.add(contents.text());
  12. }
  13. }catch (IOException e){
  14. e.printStackTrace();
  15. };
  16.  
  17. return null;
  18. }@Override
  19. protected void onPostExecute(String result){
  20. list.setAdapter(adapter);
  21. }
  22. }
  23. CustomListAdapter adapter;
  24.  
  25. @Override
  26. protected void onCreate(Bundle savedInstanceState) {
  27. super.onCreate(savedInstanceState);
  28. setContentView(R.layout.activity_listik);
  29. getSupportActionBar().setDisplayShowHomeEnabled(true);
  30. getSupportActionBar().setLogo(R.drawable.logo_bar);
  31. getSupportActionBar().setDisplayUseLogoEnabled(true);
  32. dialog = new Dialog(Listik.this);
  33. dialog2 = new Dialog(Listik.this);
  34. dialog2.getWindow().setLayout(WindowManager.LayoutParams.FILL_PARENT, WindowManager.LayoutParams.FILL_PARENT);
  35. dialog2.setContentView(R.layout.cifra);
  36. dialog.getWindow().setLayout(WindowManager.LayoutParams.FILL_PARENT, WindowManager.LayoutParams.FILL_PARENT);
  37. dialog.setContentView(R.layout.quoteoftheday);
  38. list = (ListView)findViewById(R.id.list23);
  39. list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  40. @Override
  41. public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
  42. Toast toast = Toast.makeText(getApplicationContext(),position+"",Toast.LENGTH_LONG);
  43. toast.show();//примерно так надо будет получить все ссылки и дать им позицию.
  44. }
  45. });
  46. new NewThread().execute();
  47. adapter = new CustomListAdapter(this,hello,imgid);
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement