Read about simple sqlite database example in android, The latest news, videos, and discussion topics about simple sqlite database example in android from alibabacloud.com
1 Preparatory work(1) Move the Adb.exe from the \sdk\platform-tools directory to the \sdk\tools directory (mainly to see emulator these files in which folder to move Adb.exe to which folder);(2) Move the Sqlite3.exe from the \sdk\platform-tools directory to the \sdk\tools directory (IBID.)2 Open CMD interface, CD to \sdk\tools directory, run instruction adb shell into ADB interface3 Navigate to the location of the database, chmod 777 file Modify permi
Daoexample. * * Run it as a Java application (not Android).* * @author Markus */public class Exampledaogenerator {public static void main (string[] args) throws Exception {/ /The first parameter of the method is used to update the database version number, and the second parameter is the package path of the DAO class to be generated. Schema schema = new schema (1, "de.greenrobot.daoexample");
primary key id.
No matter whether the third parameter contains data, the Insert () method will inevitably add a record. If the third parameter is Null, a record with Null values other than the primary key will be added. The Insert () method actually adds data by constructing an insert statement. The second parameter of the Insert () method is used to specify the name of the null field. I believe you will be confused about this parameter, what is the role of this parameter? If the value of the t
(R.layout.activity_main); Sqliteopenhelper helper = new Mydatabasehelper (this); Helper.getwritabledatabase (); } }After running the database is created, you can see the corresponding database in the Data\data\ package name \databases in DDMSIn the case of starting the virtual machine, you can enter the database from the command line.Specific as foll
Insert Database (SQLite) errorThis address: Http://blog.csdn.net/caroline_wendyError:android.database.sqlite.SQLiteException:no such Table:step (code 1):, While Compiling:insert into step (duration,date,counter) VALUES (?,?,?).Error: Insert database error, no table found, write parameter where table is inserted, and parameter place pass in null value. Cause: T
SQLite is especially convenient for storing mobile phone data, but I found some problems during usage:
Data Type:
Case Insensitive
Text Text
Numeric Value
Integer Integer
Real Decimal
None No type
The above data type is correct.
1. However, if you use other data types such as varchar to create a table, an error occurs. You cannot create a table.
2. If you have used some SQLite table
Let's start with a small program. The detailed parsing introduction will be detailed in later articles. It's already am. I am so sleepy that I can only move this job to tomorrow. Paste the code first today.
(Store data in the database, and then read the data)
Main. xml
Activity Code
Package cn.com. SQLite;
Others are default. Run the command to obtain the preceding result.
----------------------------
The example in this article describes a C # simple query SQLite database for data. Share to everyone for your reference, specific as follows:
SQLite Database Driver component
using System.Data.SQLite;
Insert
entities and DAOs for the example project DaoExample. ** Run it as a Java application (not Android ). ** @ author Markus */public class ExampleDaoGenerator {public static void main (String [] args) throws Exception {// The first parameter of this method is used to update the database version number, the second parameter is the package path of the DAO class to be
Project Source Download
Https://github.com/Wang-Jun-Chao/AndroidProjects
SQLite database
Lightweight relational database
The api:sqliteopenhelper to use to create the database
You must define a construction method:
//arg1:数据库文件的名字
//arg2:游标工厂
//arg3:数据库版本
public MyOpenHelper(Context context, String name, CursorFa
"}); System.out.println (i); } Public voidUpdateapi () {contentvalues values=Newcontentvalues (); Values.put ("Name", "De bang"); inti = db.update ("Person", values, "_id =?",Newstring[]{"2"}); System.out.println (i); } Public voidSelectapi () {//arg1: Fields for Queries//arg2: Where Condition of the query//Arg3:where placeholder for a conditioncursor cursor = db.query ("Person",NULL,NULL,NULL,NULL,NULL,NULL,NULL); while(Cursor.movetonext ()) {String name= cursor.getstring
an instance of creating a Sqlitedatabase object that queries only with SQL statements
protected void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate);
Setcontentview (R.layout.activity_main); Each program has its own database, and does not interfere//create a database and open, this method returns a Sqlitedadabase object (if created without, open directly)// The name of this
This example describes the simple use of a checkbox in Android development. Share to everyone for your reference, specific as follows:
checkbox is a common control in the development of the interface, Android UI development also has a checkbox, simple to say that it is used
This example describes the Android Simple button event response synthesis hint control toast application. Share to everyone for your reference, specific as follows:
We've talked about defining a button object in Main.xml, and here we'll learn how button implements the event response.
Event handling that is triggered by button buttons, we call the event Handle,
Android Development Series (9): Create a database and complete simple CRUD operations, androidcrud
This blog post mainly implements simple database creation and CRUD operations.
First, create an Android Project named db
1. Complet
This article illustrates the simple application of Android programming imitation iphone drag photo effects gallery. Share to everyone for your reference, specific as follows:
Step 1: prepare the picture material.
Will icon2,icon3,icon4,icon5,icon6 five pictures into the res/drawable plus icon.png itself a total of 6 pictures.
Step 2: new Android project, named
Developing games on Android is something that Android developers aspire to, have a sense of achievement and fun, and get financial rewards. So how do you develop Android games? Here's a simple example of getting started.
First, the creation of new projects
First, we create
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.