daily pastebin goal
32%
SHARE
TWEET

Untitled

a guest Nov 23rd, 2017 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @Override
  2. public void onCreate(Bundle savedInstanceState) {
  3.     super.onCreate(savedInstanceState);
  4.     setContentView(R.layout.activity_main);
  5.     setListAdapter(new ArrayAdapter<String>(this, R.layout.row,R.id.label,items));
  6.  
  7.     view = this.getWindow().getDecorView();
  8.     view.setBackgroundResource(R.color.white);
  9. }
  10.  
  11.  
  12. public void onListItemClick(ListView parent, View v, char position, long id) {
  13.     String s = label.getText().toString();
  14.     double l = Double.parseDouble(s);
  15.     double o;
  16.     switch (position) {
  17.         case 0:
  18.             view.setBackgroundResource(R.color.red);
  19.             break;
  20.         case 1:
  21.             view.setBackgroundResource(R.color.green);
  22.             break;
  23.         case 2:
  24.             view.setBackgroundResource(R.color.white);
  25.             break;
  26.         case 3:
  27.             view.setBackgroundResource(R.color.orange);
  28.             break;
  29.  
  30.     }
  31. }
RAW Paste Data
Top