@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle item selection switch (item.getItemId()) { case R.id.menu_settings: Intent si = new Intent(getApplicationContext(), MicroWebServerSettingsActivity.class); si.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivityForResult(si, 0); return true; case R.id.menu_logs: Intent li = new Intent(getApplicationContext(), LogSettingsActivity.class); li.putExtra(LogSettingsActivity.MINLEVEL, lea.getMinLevel()); li.putExtra(LogSettingsActivity.MAXLEVEL, lea.getMaxLevel()); li.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivityForResult(li, LogSettingsActivity.SET); return true; } return false; }
public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == MicroWebServerSettingsActivity.OK) { if (binder.isServerUp()) binder.restartServer(); } if (requestCode == LogSettingsActivity.SET && resultCode == LogSettingsActivity.SET) { int minlevel = data.getIntExtra(LogSettingsActivity.MINLEVEL, -1); int maxlevel = data.getIntExtra(LogSettingsActivity.MAXLEVEL, -1); System.err.println("loglevel filter " + minlevel + " -> " + maxlevel); lea.filter(minlevel, maxlevel); } }