zoukankan      html  css  js  c++  java
  • SQLite(二)

    对应的Activity代码:

    public class SqLiteDemoActivity extends Activity {

        private Button btn1=null;

        private Button btn2=null;

        private Button btn3=null;

        private Button btn4=null;

        private Button btn5=null;

        private Button btn6=null;

        private TextView datatxt=null;

        /** Called when the activity is first created. */

        @Override

        public void onCreate(Bundle savedInstanceState) {

            super.onCreate(savedInstanceState);

            setContentView(R.layout.main);

            btn1=(Button)findViewById(R.id.btn);

            btn1.setOnClickListener(new OnClickListener(){

               public void onClick(View v) {

                  // TODO Auto-generated method stub

                  System.out.println("the db is create");              

                  SqlHelper db=new SqlHelper(SqLiteDemoActivity.this, "myhome.db");

                   db.getWritableDatabase();

                   Toast.makeText(SqLiteDemoActivity.this, "db", Toast.LENGTH_LONG).show();

               }

            

            });   

            btn2=(Button)findViewById(R.id.btn2);

            btn2.setOnClickListener(new OnClickListener(){

               public void onClick(View v) {

                  // TODO Auto-generated method stub

                  SqlHelper db=new SqlHelper(SqLiteDemoActivity.this, "myhome.db",3);

                   db.getWritableDatabase();

                   System.out.println("db is update");

                   db.close();

               }

            

            });

            

  • 相关阅读:
    消灭WinRAR广告
    DLL:操作数据库和表
    MySQL的概述和基础(学习整理)
    MySQL个人用户的安装配置详解
    Maven的几种新建项目方式
    解决Maven的jar包冲突问题
    Maven Web项目出现org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException错误
    Maven的概述和基础(学习整理)
    从Maven中央仓库下载jar包
    Maven的New中没有Servlet问题(IDEA)
  • 原文地址:https://www.cnblogs.com/itfenqing/p/4429527.html
Copyright © 2011-2022 走看看