Methods Summary |
---|
protected void | onCreate(android.os.Bundle savedInstanceState)
super.onCreate(savedInstanceState);
mUsageStatsManager = (UsageStatsManager) getSystemService(Context.USAGE_STATS_SERVICE);
mAdapter = new Adapter();
setListAdapter(mAdapter);
|
public boolean | onCreateOptionsMenu(android.view.Menu menu)
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main, menu);
return super.onCreateOptionsMenu(menu);
|
public boolean | onOptionsItemSelected(android.view.MenuItem item)
switch (item.getItemId()) {
case R.id.log:
startActivity(new Intent(this, UsageLogActivity.class));
return true;
default:
return super.onOptionsItemSelected(item);
}
|
protected void | onResume()
super.onResume();
updateAdapter();
|
private void | updateAdapter()
long now = System.currentTimeMillis();
long beginTime = now - USAGE_STATS_PERIOD;
Map<String, UsageStats> stats = mUsageStatsManager.queryAndAggregateUsageStats(
beginTime, now);
mAdapter.update(stats);
|