7 |
import android.app.ListActivity; |
import android.app.ListActivity; |
8 |
import android.app.ProgressDialog; |
import android.app.ProgressDialog; |
9 |
import android.content.Intent; |
import android.content.Intent; |
10 |
|
import android.net.Uri; |
11 |
import android.os.AsyncTask; |
import android.os.AsyncTask; |
12 |
import android.os.Bundle; |
import android.os.Bundle; |
13 |
import android.view.View; |
import android.view.View; |
33 |
|
|
34 |
DepartureFetcher fetcher; |
DepartureFetcher fetcher; |
35 |
|
|
36 |
|
double latitude,longitude; |
37 |
|
|
38 |
@Override |
@Override |
39 |
protected void onCreate(Bundle savedInstanceState) { |
protected void onCreate(Bundle savedInstanceState) { |
40 |
super.onCreate(savedInstanceState); |
super.onCreate(savedInstanceState); |
44 |
setListAdapter(adapter); |
setListAdapter(adapter); |
45 |
|
|
46 |
Intent launchedBy = getIntent(); |
Intent launchedBy = getIntent(); |
47 |
|
|
48 |
|
latitude = launchedBy.getDoubleExtra("latitude", 0.0); |
49 |
|
longitude = launchedBy.getDoubleExtra("longitude", 0.0); |
50 |
|
|
51 |
String name = launchedBy.getStringExtra("name"); |
String name = launchedBy.getStringExtra("name"); |
52 |
((TextView) findViewById(R.id.stationName)).setText( name ); |
((TextView) findViewById(R.id.stationName)).setText( name ); |
53 |
|
|
54 |
String addr = launchedBy.getStringExtra("address"); |
String addr = launchedBy.getStringExtra("address"); |
55 |
((TextView) findViewById(R.id.stationAddr)).setText( addr ); |
((TextView) findViewById(R.id.stationAddr)).setText( addr ); |
56 |
|
|
57 |
|
findViewById(R.id.header).setOnClickListener( mapLauncher ); |
58 |
|
|
59 |
NumberFormat format = NumberFormat.getNumberInstance(); |
NumberFormat format = NumberFormat.getNumberInstance(); |
60 |
format.setMaximumFractionDigits(1); |
format.setMaximumFractionDigits(1); |
137 |
} |
} |
138 |
} |
} |
139 |
|
|
140 |
|
View.OnClickListener mapLauncher = new View.OnClickListener() { |
141 |
|
@Override |
142 |
|
public void onClick(View v) { |
143 |
|
Uri uri = Uri.parse("geo:" + latitude + "," + longitude); |
144 |
|
startActivity( new Intent(Intent.ACTION_VIEW, uri)); |
145 |
|
} |
146 |
|
}; |
147 |
|
|
148 |
|
|
149 |
class DepartureFetcher extends AsyncTask<String, Void, Void> { |
class DepartureFetcher extends AsyncTask<String, Void, Void> { |
150 |
|
|