Page MenuHomec4science

PatientActivity.java
No OneTemporary

File Metadata

Created
Thu, Jan 9, 11:58

PatientActivity.java

package ch.epfl.pharma;
import java.util.Locale;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import ch.epfl.pharma.database.DatabaseHelper;
import ch.epfl.pharma.framework.Patient;
public class PatientActivity extends Activity {
@SuppressWarnings("unused")
private final static String TAG = PatientActivity.class.getName();
private DatabaseHelper mDbHelper;
private Patient patient;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getIntent();
long patientId = intent.getLongExtra(ManagePatientsActivity.EXTRA_PATIENT_ID, 0L);
// retrieve patient
String dbName = getResources().getString(R.string.database_name);
mDbHelper = new DatabaseHelper(this, dbName);
mDbHelper.openDatabase();
patient = mDbHelper.getPatient(patientId);
mDbHelper.close();
// set title
CharSequence title = patient.getLastname().toUpperCase(Locale.ENGLISH) +
" " + patient.getFirstname();
setTitle(title);
setContentView(R.layout.activity_patient);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.patient, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}

Event Timeline