Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. ArrayList<String> dataItems = new ArrayList<String>();
  2. String[] dataArray = new String[]{"Notificação"};
  3.  
  4. @Override
  5. protected void onCreate(Bundle savedInstanceState) {
  6. super.onCreate(savedInstanceState);
  7. setContentView(R.layout.activity_configuracoes);
  8.  
  9. List<String> dataTemp = Arrays.asList(dataArray);
  10. dataItems.addAll(dataTemp);
  11. listView = (ListView) findViewById(R.id.listView);
  12. adapter = new ListAdapter(Configuracoes.this, dataItems);
  13. adapter.setCustomButtonListner(Configuracoes.this);
  14. listView.setAdapter(adapter);
  15.  
  16. }
  17.  
  18. @Override
  19. public void onButtonClickListner(int position, String value) {
  20.  
  21. if (position == 0) {
  22. Toast.makeText(Configuracoes.this, "Switch On " + value,
  23. Toast.LENGTH_SHORT).show();
  24. new Go().Setting();
  25. } else {
  26. Toast.makeText(Configuracoes.this, "Switch Off " + value,
  27. Toast.LENGTH_SHORT).show();
  28. new Go().Setting();
  29. }
  30.  
  31. }
  32.  
  33.  
  34. public class Go {
  35. public void Setting() {
  36. Intent intent = new Intent(Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS);
  37. intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  38. startActivity(intent);
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement