Beginning SQLite with android – fundamentals part 3

my page
https://www.facebook.com/BITWIS3

..custom cursor adapter example

import android.content.Context;
import android.database.Cursor;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CursorAdapter;
import android.widget.TextView;

/**
* Created by gaine on 11/24/2017.
*/

public class MyCustomCursorAdapter extends CursorAdapter {
public MyCustomCursorAdapter(Context context, Cursor c) {
super(context, c, 0);
}
// this is used to inflate new view and return it
@Override
public View newView(Context context, Cursor cursor, ViewGroup viewGroup) {
return LayoutInflater.from(context).inflate(R.layout.listview_item,viewGroup,false);
}

//where you bind data, aka initialize views and attach data

@Override
public void bindView(View view, Context context, Cursor cursor) {

TextView tvname = (TextView)view.findViewById(R.id.lv_tv1);
TextView tvage = (TextView)view.findViewById(R.id.lv_tv2);

String name = cursor.getString(1);
String age = cursor.getString(2);

tvname.setText(name);
tvage.setText(age);

}
}

Beginning SQLite with android – fundamentals part 4

Channel: Joshua Gainey
Published: 2017-11-24 06:23:16
Duration: 15M59S
Views: 1
Likes: 0
Favorites: 0

Beginning SQLite with android – fundamentals part 1

(my dog was making sounds in background lol)
facebook page
https://www.facebook.com/BITWIS3/

download sqlitestudio
https://sqlitestudio.pl/index.rvt?act=download

example queries
//table creation

CREATE TABLE _tutorial_table (
_id INTEGER PRIMARY KEY AUTOINCREMENT,
_name STRING,
_age STRING
);

//Viewing data

SELECT * FROM _tutorial_table;
SELECT _name FROM _tutorial_table

//Deleting data
DELETE FROM _tutorial_table WHERE _name = ‘Joe’;

//updating value in table
UPDATE _tutorial_table SET _name = ‘Josh2’ WHERE _id = 0

//insert data
INSERT INTO _tutorial_table (_name, _age)
VALUES (‘insertedNameJoe’, ‘100’);

Channel: Joshua Gainey
Published: 2017-11-23 11:56:06
Duration: 18M15S
Views: 14
Likes: 1
Favorites: 0

Beginning SQLite with android – fundamentals part 2

Channel: Joshua Gainey
Published: 2017-11-23 12:59:01
Duration: 24M16S
Views: 5
Likes: 0
Favorites: 0

Project Manager android

Channel: Joshua Gainey
Published: 2017-10-28 16:18:14
Duration: 18M41S
Views: 36
Likes: 1
Favorites: 0

JottME notification maker / quick note organizer

Channel: Joshua Gainey
Published: 2017-11-08 07:47:16
Duration: 6M51S
Views: 117
Likes: 0
Favorites: 0

Leave a Reply

Your email address will not be published. Required fields are marked *