摘要: public class MainActivity extends Activity implements OnChildClickListener { private List<Map<String, Object>> group; private List<List<Map<String, Object>>> children; private String[] groupFrom = { "group" }; private String[] childFrom = { "child" } 阅读全文
posted @ 2012-12-12 15:59 Mr.haox 阅读(428) 评论(0) 推荐(0) 编辑
摘要: public class MainActivity extends Activity implements OnClickListener { private static final int INIT_DB_VERSION = 1; private static final int UPGRADE_DB_VERSION = 2; private Button bt1, bt2; private MydbHelper dbh; private SQLiteDatabase db; @Override protected void onCreate(Bu... 阅读全文
posted @ 2012-12-12 09:16 Mr.haox 阅读(629) 评论(0) 推荐(1) 编辑
摘要: public class MainActivity extends Activity { private List<Map<String, Object>> listItems; private String[] names; private String[] ages; private ListView lv; private MyAdapter adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInst... 阅读全文
posted @ 2012-12-11 10:18 Mr.haox 阅读(407) 评论(0) 推荐(0) 编辑
摘要: public class MainActivity extends Activity { private static final String FILE_NAME = "file_output.txt"; private Button bt1, bt2; private TextView tv; private EditText et; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ... 阅读全文
posted @ 2012-12-11 10:18 Mr.haox 阅读(361) 评论(0) 推荐(0) 编辑
摘要: 在DDMS的File Explorer中的data\data\PACKAGE_NAME\databases中可以看到数据库的创建和删除public class MainActivity extends Activity implements OnClickListener { public static final String DATABASE_NAME = "mdb"; private SQLiteDatabase database; private Button bt1, bt2, bt3; @Override protected void onCreate... 阅读全文
posted @ 2012-12-10 17:56 Mr.haox 阅读(297) 评论(0) 推荐(0) 编辑
摘要: public class MainActivity extends Activity { private ListView lv; private String[] names; private String[] ages; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); names = getR... 阅读全文
posted @ 2012-12-10 13:04 Mr.haox 阅读(330) 评论(0) 推荐(0) 编辑
摘要: 翻页public class MainActivity extends Activity implements OnGestureListener { private GestureDetector gd; private final int FLIP_DISTANCE = 50; private TextView tv1, tv2; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); set... 阅读全文
posted @ 2012-12-08 12:36 Mr.haox 阅读(239) 评论(0) 推荐(0) 编辑
摘要: TabWidget的ID必须设置为"@android:id/tabs",FrameLayout的ID必须设置为"@android:id/tabcontent"。如果MainActivity不是继承与TabActivity,那么通过findViewById()找到TabHost后,应该先执行一次setup()方法以完成TabHost的加载;如果MainActivity是继承与TabActivity,那么TabHost的ID就必须设置为"@android:id/tabhost"public class MainActivity exten 阅读全文
posted @ 2012-12-07 15:41 Mr.haox 阅读(337) 评论(2) 推荐(1) 编辑
摘要: main Activity用来启动和关闭Service,Count是Service实现类,Manifest中加<service android:name=".Count" />public class Main extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); startService(new I... 阅读全文
posted @ 2012-12-07 11:37 Mr.haox 阅读(308) 评论(0) 推荐(0) 编辑
摘要: public class BatteryReceiver extends Activity { private TextView bl; private BroadcastReceiver br = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub if (Intent.ACTION_BATTERY_CHANG... 阅读全文
posted @ 2012-12-06 10:36 Mr.haox 阅读(305) 评论(0) 推荐(0) 编辑