blob: 3670c68b667caac7333c5bfba3f7bb13d740a3bd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
package net.cbaines.suma;
import java.sql.SQLException;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.j256.ormlite.android.apptools.OrmLiteBaseActivity;
public class BusRouteActivity extends OrmLiteBaseActivity<DatabaseHelper> implements Preferences {
final static String TAG = "BusActivity";
private TextView busRouteLabel;
private TextView busRouteCode;
private TextView busRouteID;
Toast activityToast;
private ListView busRouteView;
private Context instance;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.bus_route_activity);
instance = this;
Log.i(TAG, "getIntent().getDataString() " + getIntent().getDataString());
String strBusRouteID;
if (getIntent().getDataString().startsWith("http://data")) {
String[] uriParts = getIntent().getDataString().split("/");
strBusRouteID = uriParts[uriParts.length - 1].replace(".html", "");
} else {
String[] uriParts = getIntent().getDataString().split("/");
strBusRouteID = uriParts[uriParts.length - 1];
}
final DatabaseHelper helper = getHelper();
BusRoute busRoute = null;
try {
busRoute = helper.getBusRouteDao().queryForId(Integer.parseInt(strBusRouteID));
busRouteLabel = (TextView) findViewById(R.id.busRouteActivityLabel);
busRouteLabel.setText(busRoute.label);
busRouteCode = (TextView) findViewById(R.id.busRouteActivityCode);
busRouteCode.setText(busRoute.code);
busRouteID = (TextView) findViewById(R.id.busRouteActivityID);
busRouteID.setText(String.valueOf(busRoute.id));
busRouteView = (ListView) findViewById(R.id.busRouteBusStops);
} catch (NumberFormatException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
POIArrayAdapter arrayAdapter = new POIArrayAdapter(instance, busRoute.getRouteBusStops(instance));
busRouteView.setAdapter(arrayAdapter);
}
}
|