Exemplo n.º 1
0
 @Override
 public void onReceive(Context context, Intent intent) {
   int level = intent.getIntExtra("level", 0);
   mLastBattery = level + "%";
   for (Map<String, Object> map : mLastData) {
     if (map.get("title").equals("Battery")) {
       map.put("info", mLastBattery);
       break;
     }
   }
   adapter.reloadData(mLastData);
 }
Exemplo n.º 2
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   // Log.v("TaskActivity", item.getTitle().toString() + " id=" +
   // item.getItemId());
   boolean sucess = true;
   switch (item.getItemId()) {
     case 3001:
       mLastData = getData();
       adapter.reloadData(mLastData);
       break;
     default:
       sucess = super.onOptionsItemSelected(item);
   }
   return sucess;
 }
Exemplo n.º 3
0
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    cmd = new CMDExecute();
    activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
    lv = new ListView(this);
    mLastData = getData();
    // SimpleAdapter adapter = new SimpleAdapter(this, mLastData,
    // R.layout.list_item_number_two_text,
    // new String[] { "title", "info", "no" }, new int[] { R.id.text1,
    // R.id.text2, R.id.orderno });
    adapter = new HardwareAdapter(this);
    lv.setAdapter(adapter);
    adapter.reloadData(mLastData);
    setContentView(lv);
    lv.setOnItemClickListener(this);
    registerReceiver(batteryReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
  }