markella92

Untitled

Aug 28th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.01 KB | None | 0 0
  1.  
  2. public class ScrollableTabsActivity2 extends AppCompatActivity {
  3.  
  4. private Toolbar toolbar;
  5. private TabLayout tabLayout;
  6. private ViewPager viewPager;
  7. private Button logout_user;
  8. //private SQLiteHandler db;
  9. private SessionManager session;
  10. private TextView txtName;
  11. private TextView txtEmail;
  12. int s;
  13. String intentt="";
  14. File file;
  15. Uri filePath;
  16. ListView lv;
  17. ArrayList<Integer> hm=new ArrayList<>();
  18. String path=null;
  19. ArrayList<Planet> planetList=new ArrayList();
  20.  
  21. private String myString = "azz";
  22. ArrayList<Integer> arraylistInteger;
  23. String value="";
  24. String numero_tavolo="";
  25. ArrayList<Integer> hm3=new ArrayList<>();
  26. ArrayList<Integer> hm_quantitàpizze=new ArrayList<>();
  27. TextView numero_tavolo_text_view;
  28.  
  29.  
  30. @Override
  31. protected void onCreate(Bundle savedInstanceState) {
  32. super.onCreate(savedInstanceState);
  33. setContentView(R.layout.activity_scrollable_tabs2);
  34.  
  35.  
  36. toolbar = (Toolbar) findViewById(R.id.toolbar);
  37. setSupportActionBar(toolbar);
  38. txtName = (TextView) findViewById(R.id.name);
  39. txtEmail = (TextView) findViewById(R.id.numero_telefonico);
  40. numero_tavolo_text_view=(TextView)findViewById(R.id.numero_tavolo);
  41. logout_user=(Button) findViewById(R.id.crisbio);
  42.  
  43. logout_user.setOnClickListener(new View.OnClickListener() {
  44.  
  45. @Override
  46. public void onClick(View v) {
  47. logoutUser();
  48. }
  49. });
  50.  
  51.  
  52.  
  53. getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  54.  
  55. viewPager = (ViewPager) findViewById(R.id.viewpagerr);
  56. setupViewPager(viewPager);
  57.  
  58. tabLayout = (TabLayout) findViewById(R.id.tabss);
  59. tabLayout.setupWithViewPager(viewPager);
  60.  
  61.  
  62. Bundle extras = getIntent().getExtras();
  63. if (extras != null) {
  64. value = extras.getString("PATH FILE DA AGGIORNARE");
  65. numero_tavolo=extras.getString("NUMERO_TAVOLO");
  66. file = new File(value);
  67. System.out.println("FILE:" + file);
  68.  
  69. FileInputStream is = null;
  70. try {
  71. is = new FileInputStream(file);
  72. } catch (FileNotFoundException e) {
  73. e.printStackTrace();
  74. }
  75.  
  76. DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
  77. DocumentBuilder dBuilder = null;
  78. try {
  79. dBuilder = dbFactory.newDocumentBuilder();
  80. } catch (ParserConfigurationException e) {
  81. e.printStackTrace();
  82. }
  83. Document doc = null;
  84. try {
  85. doc = dBuilder.parse(is);
  86. } catch (SAXException e) {
  87. e.printStackTrace();
  88. } catch (IOException e) {
  89. e.printStackTrace();
  90. }
  91.  
  92. Element element = doc.getDocumentElement();
  93. element.normalize();
  94.  
  95. int a;
  96. int b;
  97. NodeList nList = doc.getElementsByTagName("checkboxes_pizza");
  98. hm.clear();
  99. hm_quantitàpizze.clear();
  100.  
  101. for (int i = 0; i < nList.getLength(); i++) {
  102. Node node = nList.item(i);
  103.  
  104. if (node.getNodeType() == Node.ELEMENT_NODE) {
  105. Element element2 = (Element) node;
  106. //tv1.setText(tv1.getText()+"\nName : " + getValue("name", element2)+"\n");
  107.  
  108. String id = getValue("id", element2);
  109. a = Integer.parseInt(id);
  110. String idd = getValue("quantita", element2);
  111. b = Integer.parseInt(idd);
  112.  
  113.  
  114. System.out.println("XMLLLLLLLLLL:" + b);
  115.  
  116. hm.add(a);
  117. hm_quantitàpizze.add(b);
  118.  
  119. System.out.println("AZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ:" + hm_quantitàpizze);
  120. System.out.println("LAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA:" + hm);
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127. }
  128.  
  129. }
  130. Bundle bundle = new Bundle();
  131. bundle.putIntegerArrayList("oki", hm);
  132. bundle.putIntegerArrayList("okiquantitapizze", hm_quantitàpizze);
  133.  
  134. MyListFragment2 myFragment = new MyListFragment2();
  135. myFragment.setArguments(bundle);
  136. FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
  137.  
  138. transaction.replace(R.id.cristo, myFragment);
  139.  
  140. transaction.commit();
  141.  
  142.  
  143. /* MyListFragment myFragment = MyListFragment.newInstance(hm,hm_quantitàpizze);
  144. FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
  145. //transaction.replace(R.id.a, myFragment);
  146. //transaction.replace(R.id.porcozio, myFragment);
  147. transaction.replace(android.R.id.content, myFragment);
  148.  
  149.  
  150. transaction.commit();
  151. */
  152.  
  153. }
  154.  
  155. numero_tavolo_text_view.setText(numero_tavolo);
  156. }
Add Comment
Please, Sign In to add comment