广州地铁离线查询app源码

原创代码,转载请标明出处http://1.crazychen.sinaapp.com/?p=529

package com.example.station;import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences.Editor;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.Toast;public class MainActivity extends Activity {private AutoCompleteTextView sstation;//起点站private AutoCompleteTextView estation;//终点站private Button check;         private String answer = "";MainActivity my = this;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);sstation = (AutoCompleteTextView) findViewById(R.id.sstation);estation = (AutoCompleteTextView) findViewById(R.id.estation);//判断是否建表if(this.getSharedPreferences("table", Context.MODE_PRIVATE).getString("table", "").equals("")){CreatTable.creattable();Editor e = this.getSharedPreferences("table", Context.MODE_PRIVATE).edit();e.putString("table", "write");e.commit();}//获取所有地铁站的名称String[] stations = DB.getAllStations();//为自动提示配置适配器sstation.setAdapter(new ArrayAdapter<String>(this, R.layout.list_item,stations));sstation.setAdapter(new ArrayAdapter<String>(this, R.layout.list_item,stations));check = (Button) findViewById(R.id.check);//查询按钮点击check.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {int start = 0;int end = 0;int head = 0;int rear = 1;int temp = 0; //检查是否输入起点站if(sstation.getText().toString().equals("")){Toast.makeText(MainActivity.this, "起点不能为空", Toast.LENGTH_SHORT).show();return;}else{end = DB.getStationId(sstation.getText().toString().trim());if(end==0){Toast.makeText(MainActivity.this, "起点不存在", Toast.LENGTH_SHORT).show();return;}}//检查是否输入终点站if(estation.getText().toString().equals("")){Toast.makeText(MainActivity.this, "终点不能为空", Toast.LENGTH_SHORT).show();return;}else{start = DB.getStationId(estation.getText().toString().trim());if(start==0){Toast.makeText(MainActivity.this, "终点不存在", Toast.LENGTH_SHORT).show();return;}}//检查起点终点是否相同if(start == end){Toast.makeText(MainActivity.this, "起点与终点相同", Toast.LENGTH_SHORT).show();return;}temp = DB.getTotal();//获取地铁站的数目int[] stack = new int[temp];//栈boolean[] find = new boolean[temp];//标记某地铁站是否被查找过了 int[] pre = new int[temp];//用于记录某站的前一站的id       //初始化起点站信息stack[0] = start;pre[0] = 0;find[start] = true;Cursor cur = null;SQLiteDatabase sld = null; while(head!=rear){/*** 下面两端代码相似度高* 其实就是分别查询头尾*//****************************/sld = DB.createOrOpenDatabase();//连接数据库                   cur=sld.rawQuery("select eid from sta_to_sta where sid="+start, new String[]{});//查询与该站连接的站点idwhile(cur.moveToNext()){//循环处理相邻站        temp = cur.getInt(cur.getColumnIndex("eid"));if(!find[temp]){pre[rear] = head;//将当前站设为相邻站的前一个站stack[rear] = temp;//将相邻站入栈find[temp] = true;//标记改相邻站已被查询                       if(temp==end){//判断该相邻站是否是终点站                          temp = rear;while(temp!=0){       cur.close();sld.close();sld = DB.createOrOpenDatabase();cur=sld.rawQuery("select name,line from station where id="+stack[temp], new String[]{});//根据id获取站名cur.moveToFirst();answer += cur.getString(cur.getColumnIndex("name"))+"("+cur.getString(cur.getColumnIndex("line"))+")---->";temp = pre[temp];//获得前一个站的id}cur.close();sld.close();sld = DB.createOrOpenDatabase();//最后在重复一次上述过程cur=sld.rawQuery("select name,line from station where id="+stack[temp], new String[]{});                          cur.moveToFirst();answer += cur.getString(cur.getColumnIndex("name"))+"("+cur.getString(cur.getColumnIndex("line"))+")";cur.close();sld.close();goToShow();//跳转到结果展示页面return;                      }rear++;}                             }cur.close();                   sld.close();/****************************//****************************/sld = DB.createOrOpenDatabase();cur=sld.rawQuery("select sid from sta_to_sta where eid="+start, new String[]{});//查询与该站连接的站点idwhile(cur.moveToNext()){        temp = cur.getInt(cur.getColumnIndex("sid"));if(!find[temp]){pre[rear] = head;stack[rear] = temp;find[temp] = true;                       if(temp==end){                            temp = rear;while(temp!=0){   cur.close();sld.close();sld = DB.createOrOpenDatabase();cur = sld.rawQuery("select name,line from station where id="+stack[temp], new String[]{});cur.moveToFirst();answer += cur.getString(cur.getColumnIndex("name"))+"("+cur.getString(cur.getColumnIndex("line"))+")---->";temp = pre[temp];}cur.close();sld.close();sld = DB.createOrOpenDatabase();cur = sld.rawQuery("select name,line from station where id="+stack[temp], new String[]{});cur.moveToFirst();answer += cur.getString(cur.getColumnIndex("name"))+"("+cur.getString(cur.getColumnIndex("line"))+")";cur.close();sld.close();goToShow();return;                 }rear++;}                             }cur.close();sld.close();/****************************/head++;start = stack[head];}                                      }});}   //主界面返回按钮,结束程序@Overridepublic boolean onKeyDown(int keyCode, KeyEvent event) {if(keyCode == KeyEvent.KEYCODE_BACK){System.exit(0);            }return true;}//跳转到结果展示页面public void goToShow(){Intent i = new Intent(MainActivity.this,ShowActivity.class);i.putExtra("answer", answer);answer="";startActivity(i);              }
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:gravity="center"android:orientation="vertical" ><LinearLayoutandroid:orientation="vertical"android:background="#ffcc66"android:layout_marginBottom="10dip"android:layout_marginTop="10dip"android:layout_width="wrap_content"android:layout_height="fill_parent"   android:gravity="center"><LinearLayoutandroid:orientation="horizontal"android:layout_marginTop="20dip"android:layout_width="wrap_content"android:layout_height="wrap_content"><TextView android:text="出发站:" android:layout_marginLeft="17dip"android:textColor="#222222" android:layout_width="wrap_content" android:layout_height="wrap_content"android:textSize="18sp"></TextView><AutoCompleteTextView  android:id="@+id/sstation" android:singleLine="true"android:layout_marginRight="30dp"android:layout_width="140dip" android:layout_height="40dip"android:completionThreshold="1" android:hint="输入站名"android:text=""></AutoCompleteTextView></LinearLayout><LinearLayoutandroid:orientation="horizontal"android:layout_width="wrap_content"android:layout_height="wrap_content"><TextView android:text="终点站:" android:layout_marginLeft="17dip"android:textColor="#222222" android:layout_width="wrap_content" android:layout_height="wrap_content"android:textSize="18sp"></TextView><AutoCompleteTextView  android:id="@+id/estation" android:singleLine="true"android:layout_marginRight="30dp"android:layout_width="140dip" android:layout_height="40dip"android:completionThreshold="1" android:hint="输入站名"android:text=""></AutoCompleteTextView></LinearLayout><!-- 按钮部分 --><LinearLayoutandroid:orientation="horizontal"android:layout_width="wrap_content"android:layout_height="wrap_content">     <Button android:id="@+id/check"     android:text="查询"                    android:layout_width="60dip" android:layout_height="40dip"    android:layout_marginTop="10dip"></Button></LinearLayout>     </LinearLayout></LinearLayout>

DB:

package com.example.station;import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;public class DB {public static SQLiteDatabase createOrOpenDatabase()//连接数据库{      SQLiteDatabase sld=null;try{sld=SQLiteDatabase.openDatabase//连接并创建数据库,如果不存在则创建("data/data/com.example.station/mydb",null, SQLiteDatabase.OPEN_READWRITE|SQLiteDatabase.CREATE_IF_NECESSARY);}catch(Exception e){e.printStackTrace();}return sld;//返回该连接}public static void createTable(String sql){//创建表SQLiteDatabase sld=createOrOpenDatabase();//连接数据库try{sld.execSQL(sql);//执行SQL语句sld.close();//关闭连接}catch(Exception e){System.out.println("创建失败");          }       }public static int getTotal(){int total=0;SQLiteDatabase sld=createOrOpenDatabase();//连接数据库String sql = "select count(*) from station";Cursor cur=sld.rawQuery(sql, new String[]{});//查看结果集           if(cur.moveToNext()){total = cur.getInt(0);}//关闭结果集,语句及连接cur.close();sld.close();return total;}public static String[] getAllStations(){String[] str;int i = 0;SQLiteDatabase sld=createOrOpenDatabase();//连接数据库String sql = "select name from station";Cursor cur=sld.rawQuery(sql, new String[]{});str = new String[cur.getCount()];for(cur.moveToFirst();!cur.isAfterLast();cur.moveToNext()){         str[i] = cur.getString(cur.getColumnIndex("name"));i++;}//关闭结果集,语句及连接cur.close();sld.close();return str;}public static int getStationId(String name){int id=0;SQLiteDatabase sld=createOrOpenDatabase();//连接数据库String sql = "select id from station where name='"+name+"'";Cursor cur=sld.rawQuery(sql, new String[]{});//查看结果集          if(cur.moveToNext()){       id = cur.getInt(0);}return id;}public static Cursor executeQuery(String sql){SQLiteDatabase sld=DB.createOrOpenDatabase();Cursor cur=sld.rawQuery(sql, new String[]{});return cur;}}

CreateTable

package com.example.station;
public class CreatTable {public static void creattable(){       try{String sqll[]=new String[]{    "drop table if exists station","drop table if exists sta_to_sta","create table if not exists station(id integer primary key," +"name char(100),line char(100))",//建立station表"create table if not exists sta_to_sta" +"(id integer primary key,sid integer,eid integer)",//建立relation表//插入一些初始化数据"INSERT INTO 'station' VALUES ('1', '广州东站', '中转站')","INSERT INTO 'station' VALUES ('2', '体育中心', '中转站')","INSERT INTO 'station' VALUES ('3', '林和西', '中转站')","INSERT INTO 'station' VALUES ('4', '燕塘', '中转站')","INSERT INTO 'station' VALUES ('5', '体育中心南', 'APM线')","INSERT INTO 'station' VALUES ('6', '体育西路', '中转站')","INSERT INTO 'station' VALUES ('7', '石牌桥', '3号线')","INSERT INTO 'station' VALUES ('8', '杨箕', '中转站')","INSERT INTO 'station' VALUES ('9', '珠江新城', '中转站')","INSERT INTO 'station' VALUES ('10', '五羊邨', '3号线')","INSERT INTO 'station' VALUES ('11', '广州塔', '中转站')","INSERT INTO 'station' VALUES ('12', '猎德', '5号线')","INSERT INTO 'station' VALUES ('13', '海心沙', 'APM线')","INSERT INTO 'station' VALUES ('14', '客村', '中转站')","INSERT INTO 'station' VALUES ('15', '鹭江', '8号线')","INSERT INTO 'station' VALUES ('16', '赤岗', '5号线')","INSERT INTO 'station' VALUES ('17', '大塘', '3号线')","INSERT INTO 'station' VALUES ('18', '车陂南', '中转站')","INSERT INTO 'station' VALUES ('19', '科韵路', '5号线')","INSERT INTO 'station' VALUES ('20', '车陂', '4号线')","INSERT INTO 'station' VALUES ('21', '东圃', '4号线')","INSERT INTO 'station' VALUES ('22', '万胜围', '中转站')","INSERT INTO 'station' VALUES ('23', '琶洲', '8号线')","INSERT INTO 'station' VALUES ('24', '官洲', '4号线')","INSERT INTO 'station' VALUES ('25', '天河客运站', '中转站')","INSERT INTO 'station' VALUES ('26', '五山', '3号线')","INSERT INTO 'station' VALUES ('27', '长湴', '6号线')","INSERT INTO 'station' VALUES ('28', '天平架', '6号线')","INSERT INTO 'station' VALUES ('29', '梅花园', '3号线')","INSERT INTO 'station' VALUES ('30', '动物园', '5号线')","INSERT INTO 'station' VALUES ('31', '东山口', '中转站')","INSERT INTO 'station' VALUES ('32', '区庄', '中转站')","INSERT INTO 'station' VALUES ('33', '淘金', '5号线')","INSERT INTO 'station' VALUES ('34', '东湖', '6号线')","INSERT INTO 'station' VALUES ('35', '烈士陵园', '1号线')","INSERT INTO 'station' VALUES ('36', '嘉禾望岗', '中转站')","INSERT INTO 'station' VALUES ('37', '黄边', '2号线')","INSERT INTO 'station' VALUES ('38', '龙归', '3号线')","INSERT INTO 'station' VALUES ('39', '白云大道北', '3号线')","INSERT INTO 'station' VALUES ('40', '广州火车站', '中转站')","INSERT INTO 'station' VALUES ('41', '三元里', '2号线')","INSERT INTO 'station' VALUES ('42', '西村', '5号线')","INSERT INTO 'station' VALUES ('43', '小北', '5号线')","INSERT INTO 'station' VALUES ('44', '越秀公园', '2号线')","INSERT INTO 'station' VALUES ('45', '公元前', '中转站')","INSERT INTO 'station' VALUES ('46', '纪念堂', '2号线')","INSERT INTO 'station' VALUES ('47', '西门口', '1号线')","INSERT INTO 'station' VALUES ('48', '农讲所', '1号线')","INSERT INTO 'station' VALUES ('49', '海珠广场', '中转站')","INSERT INTO 'station' VALUES ('50', '北京路', '6号线')","INSERT INTO 'station' VALUES ('51', '市二宫', '2号线')","INSERT INTO 'station' VALUES ('52', '文化公园', '6号线')","INSERT INTO 'station' VALUES ('53', '昌岗', '中转站')","INSERT INTO 'station' VALUES ('54', '江南西', '2号线')","INSERT INTO 'station' VALUES ('55', '宝岗大道', '8号线')","INSERT INTO 'station' VALUES ('56', '晓港', '8号线')","INSERT INTO 'station' VALUES ('57', '江泰路', '2号线')","INSERT INTO 'station' VALUES ('58', '坦尾', '中转站')","INSERT INTO 'station' VALUES ('59', '滘口', '5号线')","INSERT INTO 'station' VALUES ('60', '河沙', '6号线')","INSERT INTO 'station' VALUES ('61', '中山八', '5号线')","INSERT INTO 'station' VALUES ('62', '如意坊', '6号线')","INSERT INTO 'station' VALUES ('63', '黄沙', '中转站')","INSERT INTO 'station' VALUES ('64', '长寿路', '1号线')","INSERT INTO 'station' VALUES ('65', '沙河顶', '6号线')","INSERT INTO 'station' VALUES ('66', '芳村', '1号线')","INSERT INTO 'station' VALUES ('67', '黄花岗', '6号线')","INSERT INTO 'station' VALUES ('68', '团一大广场', '6号线')","INSERT INTO 'station' VALUES ('69', '沙贝', '6号线')","INSERT INTO 'station' VALUES ('70', '横沙', '6号线')","INSERT INTO 'station' VALUES ('71', '浔峰岗', '6号线')","INSERT INTO 'station' VALUES ('72', '文冲', '5号线')","INSERT INTO 'station' VALUES ('73', '大沙东', '5号线')","INSERT INTO 'station' VALUES ('74', '大沙地', '5号线')","INSERT INTO 'station' VALUES ('75', '鱼珠', '5号线')","INSERT INTO 'station' VALUES ('76', '三溪', '5号线')","INSERT INTO 'station' VALUES ('77', '员村', '5号线')","INSERT INTO 'station' VALUES ('79', '潭村', '5号线')","INSERT INTO 'station' VALUES ('80', '西场', '5号线')","INSERT INTO 'station' VALUES ('81', '黄村', '4号线')","INSERT INTO 'station' VALUES ('82', '大学城北', '4号线')","INSERT INTO 'station' VALUES ('83', '大学城南', '4号线')","INSERT INTO 'station' VALUES ('84', '新造', '4号线')","INSERT INTO 'station' VALUES ('85', '石碁', '4号线')","INSERT INTO 'station' VALUES ('86', '海傍', '4号线')","INSERT INTO 'station' VALUES ('87', '低涌', '4号线')","INSERT INTO 'station' VALUES ('88', '东涌', '4号线')","INSERT INTO 'station' VALUES ('89', '黄阁汽车城', '4号线')","INSERT INTO 'station' VALUES ('90', '黄阁', '4号线')","INSERT INTO 'station' VALUES ('91', '蕉门', '4号线')","INSERT INTO 'station' VALUES ('92', '金洲', '4号线')","INSERT INTO 'station' VALUES ('93', '新港东', '8号线')","INSERT INTO 'station' VALUES ('94', '磨碟沙', '8号线')","INSERT INTO 'station' VALUES ('95', '中大', '8号线')","INSERT INTO 'station' VALUES ('96', '沙园', '8号线')","INSERT INTO 'station' VALUES ('97', '凤凰新村', '8号线')","INSERT INTO 'station' VALUES ('98', '华师', '3号线')","INSERT INTO 'station' VALUES ('99', '岗顶', '3号线')","INSERT INTO 'station' VALUES ('100', '机场南', '3号线')","INSERT INTO 'station' VALUES ('101', '人和', '3号线')","INSERT INTO 'station' VALUES ('102', '永泰', '3号线')","INSERT INTO 'station' VALUES ('103', '同和', '3号线')","INSERT INTO 'station' VALUES ('104', '京溪南方医院', '3号线')","INSERT INTO 'station' VALUES ('105', '沥滘', '3号线')","INSERT INTO 'station' VALUES ('106', '厦滘', '3号线')","INSERT INTO 'station' VALUES ('107', '大石', '3号线')","INSERT INTO 'station' VALUES ('108', '汉溪长隆', '3号线')","INSERT INTO 'station' VALUES ('109', '市桥', '3号线')","INSERT INTO 'station' VALUES ('110', '番禺广场', '3号线')","INSERT INTO 'station' VALUES ('111', '江夏', '2号线')","INSERT INTO 'station' VALUES ('112', '萧岗', '2号线')","INSERT INTO 'station' VALUES ('113', '白云文化广场', '2号线')","INSERT INTO 'station' VALUES ('114', '白云公园', '2号线')","INSERT INTO 'station' VALUES ('115', '飞翔公园', '2号线')","INSERT INTO 'station' VALUES ('116', '东晓南', '2号线')","INSERT INTO 'station' VALUES ('117', '南洲', '2号线')","INSERT INTO 'station' VALUES ('118', '洛溪', '2号线')","INSERT INTO 'station' VALUES ('119', '南浦', '2号线')","INSERT INTO 'station' VALUES ('120', '会江', '2号线')","INSERT INTO 'station' VALUES ('121', '石壁', '2号线')","INSERT INTO 'station' VALUES ('122', '广州南站', '2号线')","INSERT INTO 'station' VALUES ('123', '陈家祠', '1号线')","INSERT INTO 'station' VALUES ('124', '花地湾', '1号线')","INSERT INTO 'station' VALUES ('125', '坑口', '1号线')","INSERT INTO 'station' VALUES ('126', '西朗', '中转站')","INSERT INTO 'station' VALUES ('127', '菊树', '广佛线')","INSERT INTO 'station' VALUES ('128', '龙溪', '广佛线')","INSERT INTO 'station' VALUES ('129', '金融新高区', '广佛线')","INSERT INTO 'station' VALUES ('130', '千灯湖', '广佛线')","INSERT INTO 'station' VALUES ('131', '礌岗', '广佛线')","INSERT INTO 'station' VALUES ('132', '南桂路', '广佛线')","INSERT INTO 'station' VALUES ('133', '桂城', '广佛线')","INSERT INTO 'station' VALUES ('134', '朝安', '广佛线')","INSERT INTO 'station' VALUES ('135', '普君北路', '广佛线')","INSERT INTO 'station' VALUES ('136', '祖庙', '广佛线')","INSERT INTO 'station' VALUES ('137', '同济路', '广佛线')","INSERT INTO 'station' VALUES ('138', '季华园', '广佛线')","INSERT INTO 'station' VALUES ('139', '魁奇路', '广佛线')",        "INSERT INTO 'sta_to_sta' VALUES ('1', '1', '2')","INSERT INTO 'sta_to_sta' VALUES ('2', '1', '3')","INSERT INTO 'sta_to_sta' VALUES ('3', '1', '4')","INSERT INTO 'sta_to_sta' VALUES ('4', '4', '5')","INSERT INTO 'sta_to_sta' VALUES ('5', '3', '6')","INSERT INTO 'sta_to_sta' VALUES ('6', '2', '6')","INSERT INTO 'sta_to_sta' VALUES ('7', '6', '7')","INSERT INTO 'sta_to_sta' VALUES ('8', '6', '8')","INSERT INTO 'sta_to_sta' VALUES ('9', '6', '9')","INSERT INTO 'sta_to_sta' VALUES ('10', '8', '10')","INSERT INTO 'sta_to_sta' VALUES ('11', '9', '10')","INSERT INTO 'sta_to_sta' VALUES ('12', '9', '11')","INSERT INTO 'sta_to_sta' VALUES ('13', '9', '12')","INSERT INTO 'sta_to_sta' VALUES ('14', '11', '13')","INSERT INTO 'sta_to_sta' VALUES ('15', '11', '14')","INSERT INTO 'sta_to_sta' VALUES ('16', '14', '15')","INSERT INTO 'sta_to_sta' VALUES ('17', '14', '16')","INSERT INTO 'sta_to_sta' VALUES ('18', '14', '17')","INSERT INTO 'sta_to_sta' VALUES ('19', '18', '19')","INSERT INTO 'sta_to_sta' VALUES ('20', '18', '20')","INSERT INTO 'sta_to_sta' VALUES ('21', '18', '21')","INSERT INTO 'sta_to_sta' VALUES ('22', '18', '22')","INSERT INTO 'sta_to_sta' VALUES ('23', '22', '23')","INSERT INTO 'sta_to_sta' VALUES ('24', '22', '24')","INSERT INTO 'sta_to_sta' VALUES ('25', '4', '25')","INSERT INTO 'sta_to_sta' VALUES ('26', '25', '26')","INSERT INTO 'sta_to_sta' VALUES ('27', '25', '27')","INSERT INTO 'sta_to_sta' VALUES ('28', '4', '28')","INSERT INTO 'sta_to_sta' VALUES ('29', '4', '29')","INSERT INTO 'sta_to_sta' VALUES ('30', '8', '30')","INSERT INTO 'sta_to_sta' VALUES ('31', '8', '31')","INSERT INTO 'sta_to_sta' VALUES ('32', '31', '32')","INSERT INTO 'sta_to_sta' VALUES ('33', '30', '32')","INSERT INTO 'sta_to_sta' VALUES ('34', '32', '33')","INSERT INTO 'sta_to_sta' VALUES ('35', '31', '34')","INSERT INTO 'sta_to_sta' VALUES ('36', '31', '35')","INSERT INTO 'sta_to_sta' VALUES ('37', '36', '37')","INSERT INTO 'sta_to_sta' VALUES ('38', '36', '38')","INSERT INTO 'sta_to_sta' VALUES ('39', '36', '39')","INSERT INTO 'sta_to_sta' VALUES ('40', '40', '41')","INSERT INTO 'sta_to_sta' VALUES ('41', '40', '42')","INSERT INTO 'sta_to_sta' VALUES ('42', '40', '43')","INSERT INTO 'sta_to_sta' VALUES ('43', '40', '44')","INSERT INTO 'sta_to_sta' VALUES ('44', '45', '46')","INSERT INTO 'sta_to_sta' VALUES ('45', '45', '47')","INSERT INTO 'sta_to_sta' VALUES ('46', '45', '48')","INSERT INTO 'sta_to_sta' VALUES ('47', '45', '49')","INSERT INTO 'sta_to_sta' VALUES ('48', '49', '50')","INSERT INTO 'sta_to_sta' VALUES ('49', '49', '51')","INSERT INTO 'sta_to_sta' VALUES ('50', '49', '52')","INSERT INTO 'sta_to_sta' VALUES ('51', '53', '54')","INSERT INTO 'sta_to_sta' VALUES ('52', '53', '55')","INSERT INTO 'sta_to_sta' VALUES ('53', '53', '56')","INSERT INTO 'sta_to_sta' VALUES ('54', '53', '57')","INSERT INTO 'sta_to_sta' VALUES ('55', '58', '59')","INSERT INTO 'sta_to_sta' VALUES ('56', '58', '60')","INSERT INTO 'sta_to_sta' VALUES ('57', '58', '61')","INSERT INTO 'sta_to_sta' VALUES ('58', '58', '62')","INSERT INTO 'sta_to_sta' VALUES ('59', '62', '63')","INSERT INTO 'sta_to_sta' VALUES ('60', '63', '64')","INSERT INTO 'sta_to_sta' VALUES ('61', '63', '52')","INSERT INTO 'sta_to_sta' VALUES ('62', '63', '66')","INSERT INTO 'sta_to_sta' VALUES ('63', '65', '67')","INSERT INTO 'sta_to_sta' VALUES ('64', '32', '67')","INSERT INTO 'sta_to_sta' VALUES ('65', '34', '68')","INSERT INTO 'sta_to_sta' VALUES ('66', '50', '68')","INSERT INTO 'sta_to_sta' VALUES ('67', '60', '69')","INSERT INTO 'sta_to_sta' VALUES ('68', '69', '70')","INSERT INTO 'sta_to_sta' VALUES ('69', '69', '71')","INSERT INTO 'sta_to_sta' VALUES ('70', '72', '73')","INSERT INTO 'sta_to_sta' VALUES ('71', '73', '74')","INSERT INTO 'sta_to_sta' VALUES ('72', '74', '75')","INSERT INTO 'sta_to_sta' VALUES ('73', '75', '76')","INSERT INTO 'sta_to_sta' VALUES ('74', '21', '76')","INSERT INTO 'sta_to_sta' VALUES ('75', '19', '77')","INSERT INTO 'sta_to_sta' VALUES ('76', '77', '79')","INSERT INTO 'sta_to_sta' VALUES ('77', '12', '79')","INSERT INTO 'sta_to_sta' VALUES ('78', '42', '80')","INSERT INTO 'sta_to_sta' VALUES ('79', '61', '80')","INSERT INTO 'sta_to_sta' VALUES ('80', '20', '81')","INSERT INTO 'sta_to_sta' VALUES ('81', '24', '82')","INSERT INTO 'sta_to_sta' VALUES ('82', '82', '83')","INSERT INTO 'sta_to_sta' VALUES ('83', '83', '84')","INSERT INTO 'sta_to_sta' VALUES ('84', '84', '85')","INSERT INTO 'sta_to_sta' VALUES ('85', '85', '86')","INSERT INTO 'sta_to_sta' VALUES ('86', '86', '87')","INSERT INTO 'sta_to_sta' VALUES ('87', '87', '88')","INSERT INTO 'sta_to_sta' VALUES ('88', '88', '89')","INSERT INTO 'sta_to_sta' VALUES ('89', '89', '90')","INSERT INTO 'sta_to_sta' VALUES ('90', '90', '91')","INSERT INTO 'sta_to_sta' VALUES ('91', '91', '92')","INSERT INTO 'sta_to_sta' VALUES ('92', '23', '93')","INSERT INTO 'sta_to_sta' VALUES ('93', '93', '94')","INSERT INTO 'sta_to_sta' VALUES ('94', '16', '94')","INSERT INTO 'sta_to_sta' VALUES ('95', '15', '95')","INSERT INTO 'sta_to_sta' VALUES ('96', '56', '95')","INSERT INTO 'sta_to_sta' VALUES ('97', '55', '96')","INSERT INTO 'sta_to_sta' VALUES ('98', '96', '97')","INSERT INTO 'sta_to_sta' VALUES ('99', '26', '98')","INSERT INTO 'sta_to_sta' VALUES ('100', '98', '99')","INSERT INTO 'sta_to_sta' VALUES ('101', '7', '99')","INSERT INTO 'sta_to_sta' VALUES ('102', '100', '101')","INSERT INTO 'sta_to_sta' VALUES ('103', '38', '101')","INSERT INTO 'sta_to_sta' VALUES ('104', '39', '102')","INSERT INTO 'sta_to_sta' VALUES ('105', '102', '103')","INSERT INTO 'sta_to_sta' VALUES ('106', '103', '104')","INSERT INTO 'sta_to_sta' VALUES ('107', '29', '104')","INSERT INTO 'sta_to_sta' VALUES ('108', '17', '105')","INSERT INTO 'sta_to_sta' VALUES ('109', '105', '106')","INSERT INTO 'sta_to_sta' VALUES ('110', '106', '107')","INSERT INTO 'sta_to_sta' VALUES ('111', '107', '108')","INSERT INTO 'sta_to_sta' VALUES ('112', '108', '109')","INSERT INTO 'sta_to_sta' VALUES ('113', '109', '110')","INSERT INTO 'sta_to_sta' VALUES ('114', '37', '111')","INSERT INTO 'sta_to_sta' VALUES ('115', '111', '112')","INSERT INTO 'sta_to_sta' VALUES ('116', '112', '113')","INSERT INTO 'sta_to_sta' VALUES ('117', '113', '114')","INSERT INTO 'sta_to_sta' VALUES ('118', '114', '115')","INSERT INTO 'sta_to_sta' VALUES ('119', '41', '115')","INSERT INTO 'sta_to_sta' VALUES ('120', '44', '46')","INSERT INTO 'sta_to_sta' VALUES ('121', '51', '54')","INSERT INTO 'sta_to_sta' VALUES ('122', '57', '116')","INSERT INTO 'sta_to_sta' VALUES ('123', '116', '117')","INSERT INTO 'sta_to_sta' VALUES ('124', '117', '118')","INSERT INTO 'sta_to_sta' VALUES ('125', '118', '119')","INSERT INTO 'sta_to_sta' VALUES ('126', '119', '120')","INSERT INTO 'sta_to_sta' VALUES ('127', '120', '121')","INSERT INTO 'sta_to_sta' VALUES ('128', '121', '122')","INSERT INTO 'sta_to_sta' VALUES ('129', '35', '48')","INSERT INTO 'sta_to_sta' VALUES ('130', '47', '123')","INSERT INTO 'sta_to_sta' VALUES ('131', '64', '123')","INSERT INTO 'sta_to_sta' VALUES ('132', '66', '124')","INSERT INTO 'sta_to_sta' VALUES ('133', '124', '125')","INSERT INTO 'sta_to_sta' VALUES ('134', '125', '126')","INSERT INTO 'sta_to_sta' VALUES ('135', '126', '127')","INSERT INTO 'sta_to_sta' VALUES ('136', '127', '128')","INSERT INTO 'sta_to_sta' VALUES ('137', '128', '129')","INSERT INTO 'sta_to_sta' VALUES ('138', '129', '130')","INSERT INTO 'sta_to_sta' VALUES ('139', '130', '131')","INSERT INTO 'sta_to_sta' VALUES ('140', '131', '132')","INSERT INTO 'sta_to_sta' VALUES ('141', '132', '133')","INSERT INTO 'sta_to_sta' VALUES ('142', '133', '134')","INSERT INTO 'sta_to_sta' VALUES ('143', '134', '135')","INSERT INTO 'sta_to_sta' VALUES ('144', '135', '136')","INSERT INTO 'sta_to_sta' VALUES ('145', '136', '137')","INSERT INTO 'sta_to_sta' VALUES ('146', '137', '138')","INSERT INTO 'sta_to_sta' VALUES ('147', '138', '139')",};          for(String o:sqll){//循环所有SQL语句,进行建表和初始化一些数据操作DB.createTable(o);}     System.out.println("table");}catch(Exception e){      e.printStackTrace();            }}}

ShowActivity

package com.example.station;import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;public class ShowActivity extends Activity {@Overrideprotected void onCreate(Bundle savedInstanceState) {// TODO Auto-generated method stubsuper.onCreate(savedInstanceState);setContentView(R.layout.show);TextView show = (TextView) findViewById(R.id.show);show.setText(getIntent().getStringExtra("answer").trim());Button back = (Button) findViewById(R.id.btn_back);back.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {             finish();}});}
}

show.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:layout_gravity="center"android:orientation="vertical" ><LinearLayoutandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_gravity="center"android:layout_marginTop="30dp"     android:layout_marginLeft="10dp"    android:layout_marginRight="10dp"android:orientation="horizontal" ><TextViewandroid:layout_width="fill_parent"android:layout_height="wrap_content"android:id="@+id/show"android:text="没有数据"android:textAppearance="?android:attr/textAppearanceLarge" />    </LinearLayout>            <LinearLayoutandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_gravity="center"android:layout_marginTop="30dp"         android:orientation="horizontal" >             <Buttonandroid:text="返回"android:id="@+id/btn_back"android:textAppearance="?android:attr/textAppearanceLarge"android:layout_width="wrap_content"android:layout_height="wrap_content"/></LinearLayout>
</LinearLayout>

listitem.xml

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="fill_parent"    android:layout_height="fill_parent"android:background="#ffffff"   android:padding="10dp"    android:textSize="16sp"    android:textColor="#000000">
</TextView>

广州地铁离线查询app源码相关推荐

  1. 基于Android开发的星座查询APP源码

    本项目是一个基于安卓的星座运势查询项目源码,功能主要是星座查询,星座性格特点,联网实现的星座运势查询,和星座相关美图展示. 文件:url80.ctfile.com/f/25127180-7404788 ...

  2. 计算机毕业设计Android汽车违章查询app(源码+系统+mysql数据库+Lw文档)

    项目介绍 汽车违章查询系统是我的毕业设计课题,这个Android的app具体包括:用户注册与登录功能主要是让第一次进入APP查询违章情况的用户进行账号注册,输入自己的用户名和密码,然后注册,之后登陆, ...

  3. java计算机毕业设计基于安卓Android的城市公交查询app(源码+系统+mysql数据库+Lw文档)

    项目介绍 本课题城市公交线路查询,采用安卓平台,所完成的可扩展性.可靠性以及可重用性的城市公交线路查询系统,以满足现实生活的需要.数据库选用MySQL. 前端为移动端,采用安卓框架uniapp,开发软 ...

  4. 视频直播app源码直播弹幕系统如何实现

    视频直播app源码直播弹幕系统如何实现 直播弹幕指直播间的用户,礼物,评论,点赞等消息,是直播间交互的重要手段.美拍直播弹幕系统从 2015 年 11 月到现在,经过了三个阶段的演进,目前能支撑百万用 ...

  5. android 带记忆功能的播放器源码,【全开源可二开】带后台管理面板的在线音乐播放器Android应用APP源码...

    这是一款带后台管理面板的在线音乐播放器Android应用APP源码,可让您更快地构建在线和离线android音频播放器,代码全开源适合二次开发.该源码自带2个紫色和橙色主题(允许您添加更多主题),多语 ...

  6. cesium等高线_Cesium开源三维地球离线地图发布源码示例功能

    一.概述 Cesium开源三维地球离线地图发布源码提供了地图切换.查询定位.模型加载.专题图叠加显示和测量功能等,旨在为用户提供一个可以在Cesium快速加载离线地图或在线地图的解决方案,并提供技术支 ...

  7. android 快传 源码_最新安卓仿茄子快传APP源码包括服务端源码Android开发快传类项目源码全套...

    适使用范围:  安卓APP茄子快传源码 Android项目源码相似茄子快传的快传项目包括服务端 运行环境:  Android app 源码详细: 本项目是一个基于安卓的相似茄子快传的项目源码,包括安卓 ...

  8. 至尊版影视双端app源码对接苹果CMS 带商城码支付

    至尊版影视双端app源码对接苹果CMS 带商城体系投屏选集直播盒子码支出 安装说明: 前后端将域名替换为你的域名; 称号:通霸V5影视 改成你的影视称号; 后台登录账号密码去数据库ap_user查询! ...

  9. 现如今市场竞争激烈,语音交友陪玩APP源码如何适配用户?

    互联网+是两化融合的升级版,将互联网作为当前信息化发展的核心特征,提取出来,并与工业.商业.金融业.服务业等全面融合.这其中关键就是创新,只有创新才能让这个+真正有价值.有意义. 语音交友陪玩APP源 ...

最新文章

  1. 22张深度学习精炼图笔记总结
  2. Python中“is”和“==”的区别
  3. 【转载】cookie
  4. 12、MySQL逻辑运算符
  5. 看完这篇 HTTPS,和面试官扯皮就没问题了
  6. python---------sys.argv的作用
  7. eclipse maven 创建总POM 工程
  8. C++ 控制结构和函数(二) —— 函数I(Functions I)
  9. Celery参数详解、配置参数
  10. 网络连接数4000多正常吗_怀孕36周时胎儿发育情况是怎样的?胎儿体重有4斤多正常吗?...
  11. ChaiNext:比特币再度考验5W关口
  12. JSP中的include的两种用法
  13. 旋转区域_高空旋转雾化机雾桩应用场所、高压喷雾立杆式降尘设备,高压微雾除尘系统原理以及优势...
  14. UnityEditor-Windows编辑器与Inspector编辑器
  15. 时间序列分析和预测(含实例及代码)
  16. 超分算法在 WebRTC 高清视频传输弱网优化中的应用
  17. MySQL学习笔记(六)索引类别
  18. 基于android物流快递服务系统app
  19. 阿里云独享虚拟主机和共享虚拟主机区别对比
  20. java 身份证号码校验工具类

热门文章

  1. 在gitlab上 与fork的源代码保持同步
  2. Day13 多态、Object、抽象、接口
  3. 发布一个图片抽奖程序
  4. Linux c语言 beep,用Beep()函数来实现c语言编写歌曲
  5. 精心整理的超好的共享文库
  6. ip route show命令
  7. Matlab和Simulink联合仿真入门知识简介(在汽车系统动力学的应用)
  8. uva 109 SCUD Busters
  9. 实现一个机器人陪女友自动聊天(不用写一行代码),终于可以安心“打农药”啦
  10. C语言实现通讯录(含有添加,删除,查找,修改,显示,清空,以姓名排序功能)