Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F98071812
PatientActivity.java
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Jan 9, 11:58
Size
1 KB
Mime Type
text/x-java
Expires
Sat, Jan 11, 11:58 (2 d)
Engine
blob
Format
Raw Data
Handle
23499122
Attached To
R3229 Genome Privacy - SHCS App
PatientActivity.java
View Options
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
,
0
L
);
// 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
Log In to Comment