Advertisement
Guest User

Untitled

a guest
Jun 16th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. public class MainActivity extends AppCompatActivity implements View.OnClickListener
  2. {
  3. //Some fields
  4. ListView lv1;
  5. //Other fields
  6.  
  7. @Override
  8. protected void onCreate(Bundle savedInstanceState)
  9. {
  10. super.onCreate(savedInstanceState);
  11. setContentView(R.layout.activity_main);
  12.  
  13. Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
  14. setSupportActionBar(myToolbar);
  15. findViewById(R.id.bgl0).setBackgroundColor(Color.rgb(175, 175, 175));
  16.  
  17. //Creating fields
  18.  
  19.  
  20. lv1 = (ListView) findViewById(R.id.custom_list);
  21. lv1.setBackgroundColor(Color.rgb(175, 175, 175));
  22. lv1.setLongClickable(true);
  23. lv1.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener()
  24. {
  25. @Override
  26. public boolean onItemLongClick(AdapterView<?> arg0, View arg1, int pos, long id)
  27. {
  28. //WHEN I HOLD AN ITEM, I'D LIKE TO GET ALL THE INFORMATION HERE, BUT THEY ARE INSIDE THE CustomListAdapter
  29. return true;
  30. }
  31. });
  32.  
  33. //Setting listeners
  34. start();
  35. }
  36.  
  37. @Override
  38. public boolean onCreateOptionsMenu(Menu menu)
  39. {
  40. getMenuInflater().inflate(R.menu.menu, menu);
  41. return true;
  42. }
  43.  
  44. @Override
  45. public boolean onOptionsItemSelected(MenuItem item)
  46. {
  47. switch (item.getItemId())
  48. {
  49. //Setting menu items
  50. }
  51. }
  52.  
  53. @Override
  54. public void onClick(View v)
  55. {
  56. //Setting buttons
  57. }
  58.  
  59.  
  60. private void start()
  61. {
  62. //Some code
  63. lv1.setAdapter(new CustomListAdapter(MainActivity.this, myArrayList));
  64. }
  65.  
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement