Advertisement
Guest User

Untitled

a guest
Apr 20th, 2014
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. rowLink=(TableLayout)getLayoutInflater().inflate(R.layout.details, null);
  2. linearlayout.addView(rowLink);
  3.  
  4. ((ViewGroup)rowLink.getParent()).removeView(rowLink);
  5. //at this line i got an exception i.e
  6. //Method invocation '((ViewGroup) rowLink.getParent()).removeAllViews()' may produce
  7. //'java.lang.NullPointerException'
  8.  
  9.  
  10. tvrgp=(TextView)rowLink.findViewById(R.id.tvrgp);
  11. tvrg=(TextView)rowLink.findViewById(R.id.tvrg);
  12. tvra=(TextView)rowLink.findViewById(R.id.tvra);
  13. tvrp=(TextView)rowLink.findViewById(R.id.tvrp);
  14. tvrplusminus=(TextView)rowLink.findViewById(R.id.tvrplusminus);
  15. tvrpim=(TextView)rowLink.findViewById(R.id.tvrpim);
  16. try{
  17. Document doc = Jsoup.connect(temp).get(); //temp is url of webiste
  18. Element regularseason = doc.getElementsByTag("table").get(3);
  19. Elements tbody=regularseason.select("tbody");
  20. Elements row = tbody.select("tr");
  21. Element vrgp = row.select("td").get(1);
  22. Element vrg = row.select("td").get(2);
  23. Element vra = row.select("td").get(3);
  24. Element vrp = row.select("td").get(4);
  25. Element vrplusminus=row.select("td").get(5);
  26. Element vrpim = row.select("td").get(6);
  27.  
  28. tvrgp.setText(vrgp.text().trim());
  29. tvrg.setText(vrg.text().trim());
  30. tvra.setText(vra.text().trim());
  31. tvrp.setText(vrp.text().trim());
  32. tvrplusminus.setText(vrplusminus.text().trim());
  33. tvrpim.setText(vrpim.text().trim());
  34.  
  35. }catch(Exception ex)
  36. { ex.printStackTrace();}
  37.  
  38.  
  39.  
  40.  
  41. new AlertDialog.Builder(LineUps.this)
  42. .setTitle("player")
  43. .setView(rowLink)
  44. .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
  45. public void onClick(DialogInterface dialog, int which) {
  46.  
  47. }
  48. }).show();
  49.  
  50. if((ViewGroup)rowLink.getParent() != null){
  51. ((ViewGroup)rowLink.getParent()).removeView(rowLink);
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement