手机防盗的功能我们已经完成的啦,里面有挺多知识点的,大家最好总结一下。或再看看是怎样写的。
好啦,今天我们的任务比较简单,就是把手机归属地查询的界面做出来而已,逻辑我们明天才完成,这一次,我们就不会通过WebService来获得手机的归属地的啦,我们直接把数据库嵌入到的我们的应用里面,这个我们就明天再说啦,今天先把界面做好
com.xiaobin.security.ui.AToolActivity
package com.xiaobin.security.ui; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.TextView; import com.xiaobin.security.R; public class AToolActivity extends Activity implements OnClickListener { private TextView tv_atool_query; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.atool); tv_atool_query = (TextView) findViewById(R.id.tv_atool_query); tv_atool_query.setOnClickListener(this); } @Override public void onClick(View v) { switch(v.getId()) { case R.id.tv_atool_query : Intent intent = new Intent(this, QueryNumberActivity.class); startActivity(intent); break; default : break; } } }
atool.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:background="@android:color/white" android:orientation="vertical" > <TextView android:id="@+id/tv_atool_query" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="8dip" android:textSize="24sp" android:text="@string/query"/> <View android:layout_width="match_parent" android:layout_height="1dip" android:layout_marginTop="8dip" android:layout_marginBottom="8dip" android:background="#aabc04e5"/> </LinearLayout>
com.xiaobin.security.ui.QueryNumberActivity
package com.xiaobin.security.ui; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import com.xiaobin.security.R; public class QueryNumberActivity extends Activity { private TextView tv_result; private EditText et_query_number; private Button bt_query; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.query_number); tv_result = (TextView) findViewById(R.id.tv_query_result); et_query_number = (EditText) findViewById(R.id.et_query_number); } public void query(View v) { } }
query_number.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:orientation="vertical" > <EditText android:id="@+id/et_query_number" android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="number"/> <Button android:id="@+id/bt_query" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/bt_query" android:onClick="query"/> <TextView android:id="@+id/tv_query_result" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge"/> </LinearLayout>
好啦,今天的都是界面的问题而已
我们明天才会把逻辑进行完善,其中包括数据库的压缩啦,使它的体积减少
今天源码下载