Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ArrayList<String> dataItems = new ArrayList<String>();
- String[] dataArray = new String[]{"Notificação"};
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_configuracoes);
- List<String> dataTemp = Arrays.asList(dataArray);
- dataItems.addAll(dataTemp);
- listView = (ListView) findViewById(R.id.listView);
- adapter = new ListAdapter(Configuracoes.this, dataItems);
- adapter.setCustomButtonListner(Configuracoes.this);
- listView.setAdapter(adapter);
- }
- @Override
- public void onButtonClickListner(int position, String value) {
- if (position == 0) {
- Toast.makeText(Configuracoes.this, "Switch On " + value,
- Toast.LENGTH_SHORT).show();
- new Go().Setting();
- } else {
- Toast.makeText(Configuracoes.this, "Switch Off " + value,
- Toast.LENGTH_SHORT).show();
- new Go().Setting();
- }
- }
- public class Go {
- public void Setting() {
- Intent intent = new Intent(Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS);
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- startActivity(intent);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement