Android第三方数据库框架litePal使用

本文介绍了Android开发中使用的第三方数据库框架LitePal的使用经验。通过引用郭霖大神的博客,详细阐述了使用LitePal进行数据库操作的便捷之处,并提供了在MainActivity中的具体应用代码示例,展现了该框架的易用性和高效性。有兴趣的开发者可以参考提供的代码下载链接进行学习。
摘要由CSDN通过智能技术生成

1 代码参考自郭霖大神博客http://blog.csdn.net/guolin_blog/article/details/38556989

2 大神创造的框架一个字用起来就是

3 主界面MainActivity代码:

package com.example.androidlitepal;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.litepal.crud.DataSupport;
import org.litepal.tablemanager.Connector;

import com.example.androidClass.Category;
import com.example.androidClass.Comment;
import com.example.androidClass.Introduction;
import com.example.androidClass.News;
import android.app.Activity;
import android.content.ContentValues;
import android.database.sqlite.SQLiteDatabase;

public class MainActivity extends Activity implements OnClickListener {

	Button btn1, btn2, btn3, btn4, btn5, btn6, btn7, btn8, btn9, btn10, btn11, btn12, btn13, btn14, btn15, btn16, btn17,
			btn18, btn19, btn20, btn21, btn22, btn23, btn24, btn25, btn26, btn27, btn28, btn29, btn30, btn31, btn32;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		btn1 = (Button) findViewById(R.id.button1);
		btn2 = (Button) findViewById(R.id.button2);
		btn3 = (Button) findViewById(R.id.button3);
		btn4 = (Button) findViewById(R.id.button4);
		btn5 = (Button) findViewById(R.id.button5);
		btn6 = (Button) findViewById(R.id.button6);
		btn7 = (Button) findViewById(R.id.button7);
		btn8 = (Button) findViewById(R.id.button8);
		btn9 = (Button) findViewById(R.id.button9);
		btn10 = (Button) findViewById(R.id.button10);
		btn11 = (Button) findViewById(R.id.button11);
		btn12 = (Button) findViewById(R.id.button12);
		btn13 = (Button) findViewById(R.id.button13);
		btn14 = (Button) findViewById(R.id.button14);
		btn15 = (Button) findViewById(R.id.button15);
		btn16 = (Button) findViewById(R.id.button16);
		btn17 = (Button) findViewById(R.id.button17);
		btn18 = (Button) findViewById(R.id.button18);
		btn19 = (Button) findViewById(R.id.button19);
		btn20 = (Button) findViewById(R.id.button20);
		btn21 = (Button) findViewById(R.id.button21);
		btn22 = (Button) findViewById(R.id.button22);
		btn23 = (Button) findViewById(R.id.button23);
		btn24 = (Button) findViewById(R.id.button24);
		btn25 = (Button) findViewById(R.id.button25);
		btn26 = (Button) findViewById(R.id.button26);
		btn27 = (Button) findViewById(R.id.button27);
		btn28 = (Button) findViewById(R.id.button28);
		btn29 = (Button) findViewById(R.id.button29);
		btn30 = (Button) findViewById(R.id.button30);
		btn31 = (Button) findViewById(R.id.button31);
		btn32 = (Button) findViewById(R.id.button32);
		btn1.setOnClickListener(this);
		btn2.setOnClickListener(this);
		btn3.setOnClickListener(this);
		btn4.setOnClickListener(this);
		btn5.setOnClickListener(this);
		btn6.setOnClickListener(this);
		btn7.setOnClickListener(this);
		btn8.setOnClickListener(this);
		btn9.setOnClickListener(this);
		btn10.setOnClickListener(this);
		
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值