Zybotech solutions, offers job oriented courses on mobile application development for freshers and professionals with placement assistance, interactive training sessions with live project exposure.
This document provides an overview of Android application development training on accessing and manipulating data using SQLite databases on Android. It covers topics like what SQLite is, creating and connecting to databases, setting database properties, creating tables, inserting, updating, and deleting records from the databases using ContentValues and SQLiteDatabase methods. Code examples are provided for each topic.
The document discusses handling XML data in databases using the SQLXML interface in Java. It introduces the SQLXML interface that allows storing and retrieving XML data from databases. It provides code snippets that show how to:
1) Create an SQLXML object and insert an XML document into a database table
2) Retrieve an XML document from a database table using an SQLXML object
3) Update an existing SQLXML object in the database
Parameterization is nothing but giving multiple inputuanna
The document discusses different ways to parameterize test data in automation scripts, including inputting data from external files, using a datatable, looping, and interactive submission. It provides code examples of creating a FileSystemObject to work with files and folders, and using methods like CreateTextFile, CopyFile, DeleteFile, CreateFolder, and others.
This document discusses different options for saving application data in Android. It covers SharedPreferences for saving key-value pairs, internal and external file storage, and SQLite databases. For SharedPreferences, it shows how to get a SharedPreferences object, write and read preferences. For files, it explains internal and external storage and permissions. For SQLite databases, it discusses the SQLiteOpenHelper class, content values for inserting data, and querying data. It also briefly introduces the ObjectBox ORM library as an alternative to SQLite.
This document discusses using Firebase services for backendless mobile apps. It covers using Firebase Authentication to allow anonymous and social logins. It also covers using Firebase Cloud Firestore for content storage and realtime data, Firebase Cloud Functions for backend logic, and Firebase Cloud Messaging for push notifications. Code snippets in Kotlin demonstrate integrating these services, such as authenticating users anonymously, uploading and downloading files, listening to database changes, and writing Cloud Functions with Kotlin.
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
This document contains a summary of an Oracle DBA presentation on DBA commands and concepts that every developer should know. The presentation covered topics such as parallel queries, row chaining, explain plans, flashback queries, pending statistics, bulk processing, virtual private databases, extended data types, identity columns, and online table redefinition. It provided examples and demonstrations of many of these commands and concepts.
This document discusses how to work with multiple tables in a relational database using a DataSet in Visual Basic. It covers setting up data adapters and command builders to fill the DataSet with data from different tables, displaying and editing data, adding and deleting rows, and establishing relationships between tables to link related data.
The document discusses using SQLite as an embedded SQL database in Adobe AIR applications. SQLite allows storing data in a single file without a separate server. Key features covered include connecting to a SQLite database, executing SQL queries and statements, handling results, and using transactions. The document also provides examples of basic usage and links to additional SQLite resources.
This document summarizes Kenichi Ishigaki's presentation on DBD::SQLite recipes, issues, and plans at YAPC::Asia 2012. The presentation covered:
1. Ten recipes for common SQLite tasks like bulk inserts, in-memory databases, table alterations, database attachments, hooks, unicode, and custom extensions.
2. Ten issues and plans for the DBD::SQLite module, including debates around the default transaction mode, refactoring the execute method, optimization efforts, and compatibility with different compilers and platforms like iOS.
3. Questions and suggestions from the audience were welcomed on improving recipes, resolving issues, and advancing plans and roadmaps for DBD::SQLite.
The document discusses how to use SQLite database in Android applications. It covers creating a SQLiteHelper class to manage the database, defining model classes, and performing CRUD operations like inserting, updating, deleting and selecting records. Layouts are created for displaying records and for data entry forms. The onCreate() and onUpgrade() methods of SQLiteHelper are used to create and manage the database and tables.
Taming the beast - how to tame React & GraphQL, one error at a timeSusanna Wong
The document provides steps for setting up GraphQL queries in a React component to fetch data from a Cerberus API. It involves:
1. Defining the GraphQL query in a .gql file and exporting it.
2. Importing the query into a React component and constructing functions to fetch the query, passing variables.
3. Calling the fetch function on component mount/update and processing the returned data to update component state.
The document also discusses solutions for common errors like refactoring variable names, adding arrow functions to fix binding issues, and using the debugger to troubleshoot problems.
The document summarizes key objects and concepts related to working with data in .NET, including:
- The DataTable object represents tabular data as rows and columns and is used to hold data in memory for disconnected data operations. It contains DataRow objects that hold data.
- The DataSet is a memory-based representation of relational data that can contain multiple related DataTable objects and DataRelation objects defining relationships between tables.
- Other objects like DataColumn, DataView, and DataRow are used to define and interact with data in DataTable and DataSet objects, including sorting, filtering, and relating rows between tables. Data can be loaded, modified, and serialized to files or streams for transfer.
Validating JSON -- Percona Live 2021 presentationDave Stokes
JSON is a free form data exchange format which can cause problems when combined with a strictly typed relational database. Thanks to the folks at https://json-schema.org and the MySQL engineers at Oracle we can no specify required fields, type checks, and range checks.
This document provides an overview and tutorial for using SQLite database tools in Android application development. It discusses the SQLiteOpenHelper and SQLiteDatabase classes, which are used to create, open, and manage an app's database. It then demonstrates how to create a database manager class that extends SQLiteOpenHelper to define the database structure, and includes methods like addRow(), deleteRow(), and updateRow() to interact with the database. The goal is to build reusable database functionality that can be included in most Android apps.
The document discusses using SQLite database in Android applications. It explains that SQLite is a lightweight database that can be used to store and retrieve data in Android apps. It provides steps to create a database, add and retrieve records, and use the SQLiteOpenHelper class. Methods like onCreate(), onUpgrade(), and onOpen() are called at different stages of the database lifecycle. The document also discusses updating, deleting, and implementing the database in an example Android application.
Storing data is a basic and very common need in mobile apps. The Android application framework provides several storage options, one of which is SQLite databases.
In this tutorial you will see a simple Android database example. The example is based on the Android ListView Tutorial and the Android AsyncTask Tutorial, however these tutorials are not mandatory for the purpose of understanding the principles of proper Android database usage.
This document provides a tutorial on summarizing the Spring Framework. It introduces the main packages in Spring Framework including the JDBC package for data access. The JDBC package has two main subpackages - com.interface21.jdbc.core which implements low-level persistence and com.interface21.jdbc.object which presents an object-oriented view. It provides code samples demonstrating how to perform queries, updates and retrieve results using these packages.
The first half of this presentation is an introduction to Apache Cassandra's architecture, highlighting its main features: distributed (masterless), replicated, multi data center.
The second half is focused on data modeling with Apache Cassandra, the differences with the relational way of doing data modeling and a few real examples, highlighting potential issues and providing alternatives.
The primary focus of this presentation is approaching the migration of a large, legacy data store into a new schema built with Django. Includes discussion of how to structure a migration script so that it will run efficiently and scale. Learn how to recognize and evaluate trouble spots.
Also discusses some general tips and tricks for working with data and establishing a productive workflow.
SQLite is available on every Android device. Using an SQLite database in Android does not require any database setup or administration. You only have to define the SQL statements for creating and updating the database. Afterwards the database is automatically managed for you by the Android platform. In this chapter we will discuss about developing application with SQLite.
The document provides an overview of MySQL database concepts and basic CRUD operations. It discusses database, table, record, and field concepts. It also demonstrates how to navigate databases and tables in MySQL, and perform basic create, read, update, and delete operations through queries like CREATE, SELECT, UPDATE, DELETE, and DROP. These include creating databases and tables, inserting and retrieving data, updating fields, and deleting records or entire tables.
An introductory presentation about table partitioning in PostgreSQL and how to integrate it in your Rails application. Given at the Cambridge Ruby User Group meetup Mar 27th 2014.
Mysql is an open source relational database management system that can be downloaded for free from mysql.com. It allows users to define, construct, manipulate and access databases through SQL queries. The document provides an overview of mysql and databases, instructions for downloading and starting mysql, descriptions of basic SQL queries like SELECT, INSERT, UPDATE and DELETE, and examples of creating a sample employee table and running queries on it.
Mysql is a popular open source database system. It can be downloaded from the mysql website for free. Mysql allows users to create, manipulate and store data in databases. A database contains tables which hold related information. Structured Query Language (SQL) is used to perform operations like querying and manipulating data within MySQL databases. Some common SQL queries include SELECT, INSERT, UPDATE and DELETE.
This document summarizes Kenichi Ishigaki's presentation on DBD::SQLite recipes, issues, and plans at YAPC::Asia 2012. The presentation covered:
1. Ten recipes for common SQLite tasks like bulk inserts, in-memory databases, table alterations, database attachments, hooks, unicode, and custom extensions.
2. Ten issues and plans for the DBD::SQLite module, including debates around the default transaction mode, refactoring the execute method, optimization efforts, and compatibility with different compilers and platforms like iOS.
3. Questions and suggestions from the audience were welcomed on improving recipes, resolving issues, and advancing plans and roadmaps for DBD::SQLite.
The document discusses how to use SQLite database in Android applications. It covers creating a SQLiteHelper class to manage the database, defining model classes, and performing CRUD operations like inserting, updating, deleting and selecting records. Layouts are created for displaying records and for data entry forms. The onCreate() and onUpgrade() methods of SQLiteHelper are used to create and manage the database and tables.
Taming the beast - how to tame React & GraphQL, one error at a timeSusanna Wong
The document provides steps for setting up GraphQL queries in a React component to fetch data from a Cerberus API. It involves:
1. Defining the GraphQL query in a .gql file and exporting it.
2. Importing the query into a React component and constructing functions to fetch the query, passing variables.
3. Calling the fetch function on component mount/update and processing the returned data to update component state.
The document also discusses solutions for common errors like refactoring variable names, adding arrow functions to fix binding issues, and using the debugger to troubleshoot problems.
The document summarizes key objects and concepts related to working with data in .NET, including:
- The DataTable object represents tabular data as rows and columns and is used to hold data in memory for disconnected data operations. It contains DataRow objects that hold data.
- The DataSet is a memory-based representation of relational data that can contain multiple related DataTable objects and DataRelation objects defining relationships between tables.
- Other objects like DataColumn, DataView, and DataRow are used to define and interact with data in DataTable and DataSet objects, including sorting, filtering, and relating rows between tables. Data can be loaded, modified, and serialized to files or streams for transfer.
Validating JSON -- Percona Live 2021 presentationDave Stokes
JSON is a free form data exchange format which can cause problems when combined with a strictly typed relational database. Thanks to the folks at https://json-schema.org and the MySQL engineers at Oracle we can no specify required fields, type checks, and range checks.
This document provides an overview and tutorial for using SQLite database tools in Android application development. It discusses the SQLiteOpenHelper and SQLiteDatabase classes, which are used to create, open, and manage an app's database. It then demonstrates how to create a database manager class that extends SQLiteOpenHelper to define the database structure, and includes methods like addRow(), deleteRow(), and updateRow() to interact with the database. The goal is to build reusable database functionality that can be included in most Android apps.
The document discusses using SQLite database in Android applications. It explains that SQLite is a lightweight database that can be used to store and retrieve data in Android apps. It provides steps to create a database, add and retrieve records, and use the SQLiteOpenHelper class. Methods like onCreate(), onUpgrade(), and onOpen() are called at different stages of the database lifecycle. The document also discusses updating, deleting, and implementing the database in an example Android application.
Storing data is a basic and very common need in mobile apps. The Android application framework provides several storage options, one of which is SQLite databases.
In this tutorial you will see a simple Android database example. The example is based on the Android ListView Tutorial and the Android AsyncTask Tutorial, however these tutorials are not mandatory for the purpose of understanding the principles of proper Android database usage.
This document provides a tutorial on summarizing the Spring Framework. It introduces the main packages in Spring Framework including the JDBC package for data access. The JDBC package has two main subpackages - com.interface21.jdbc.core which implements low-level persistence and com.interface21.jdbc.object which presents an object-oriented view. It provides code samples demonstrating how to perform queries, updates and retrieve results using these packages.
The first half of this presentation is an introduction to Apache Cassandra's architecture, highlighting its main features: distributed (masterless), replicated, multi data center.
The second half is focused on data modeling with Apache Cassandra, the differences with the relational way of doing data modeling and a few real examples, highlighting potential issues and providing alternatives.
The primary focus of this presentation is approaching the migration of a large, legacy data store into a new schema built with Django. Includes discussion of how to structure a migration script so that it will run efficiently and scale. Learn how to recognize and evaluate trouble spots.
Also discusses some general tips and tricks for working with data and establishing a productive workflow.
SQLite is available on every Android device. Using an SQLite database in Android does not require any database setup or administration. You only have to define the SQL statements for creating and updating the database. Afterwards the database is automatically managed for you by the Android platform. In this chapter we will discuss about developing application with SQLite.
The document provides an overview of MySQL database concepts and basic CRUD operations. It discusses database, table, record, and field concepts. It also demonstrates how to navigate databases and tables in MySQL, and perform basic create, read, update, and delete operations through queries like CREATE, SELECT, UPDATE, DELETE, and DROP. These include creating databases and tables, inserting and retrieving data, updating fields, and deleting records or entire tables.
An introductory presentation about table partitioning in PostgreSQL and how to integrate it in your Rails application. Given at the Cambridge Ruby User Group meetup Mar 27th 2014.
Mysql is an open source relational database management system that can be downloaded for free from mysql.com. It allows users to define, construct, manipulate and access databases through SQL queries. The document provides an overview of mysql and databases, instructions for downloading and starting mysql, descriptions of basic SQL queries like SELECT, INSERT, UPDATE and DELETE, and examples of creating a sample employee table and running queries on it.
Mysql is a popular open source database system. It can be downloaded from the mysql website for free. Mysql allows users to create, manipulate and store data in databases. A database contains tables which hold related information. Structured Query Language (SQL) is used to perform operations like querying and manipulating data within MySQL databases. Some common SQL queries include SELECT, INSERT, UPDATE and DELETE.
The document discusses the digestive systems of various organisms including humans. It describes different types of feeders such as bulk, filter, and substrate feeders. It then explains the structures and functions of the human digestive system including the mouth, esophagus, stomach, small intestine, pancreas, liver, and large intestine. Key points covered are the roles of enzymes and hormones in digestion and the absorption of nutrients.
The document provides an overview of several topics in economics and finance through a series of lecture summaries:
1. It discusses business cycles, markets, financial institutions, and the various types of markets.
2. It then covers the flow of funds between different entities, the role of financial intermediaries, and foreign markets.
3. Several lectures focus on interest rates, present value calculations, determinants of interest rate levels, and the bond market.
4. Additional topics include monetary policy, money markets, mortgages, stock markets, foreign exchange, and derivatives.
Halloween originated 2000 years ago among Celtic pagans in Ireland, England, and France. They celebrated Samhain on October 31st, when spirits of the dead were believed to return to Earth. People wore costumes to avoid recognition by ghosts. As Christianity spread, the holiday was changed to All Saints' Day on November 1st. Trick-or-treating began as poor people begging for soul cakes in return for prayers. Irish immigrants brought Halloween traditions to America in the 1800s, carving pumpkins instead of turnips and celebrating with costumes and candy.
This video is a 3 part theatrical script about a family. The first part introduces the mother, father, and daughter characters and establishes they will be traveling together. The second part shows conflict between the parents during the car ride. The third part resolves the argument and has the family arriving happily at their destination.
This document discusses how maps are used to measure and represent planet Earth. It explains that lines of latitude and longitude create a grid system that allows locations to be precisely measured using degrees, minutes and seconds. Key elements of maps like the equator, prime meridian, hemispheres, and compass roses are also outlined to establish a framework for mapping the globe. Different map projections are introduced as well as the major components of maps.
The literal meaning of Sa’ey is to run or to make effort, but as a Hajj and Umrah term, Sa’ey denotes walking back and forth seven times between the hills of Safa and Marwah which are situated to the south and north of the Ka’bah respectively. Now there are only signs of these hills and the whole route between them is enclosed in a long gallery.
http://www.umrahpackages2014.co.uk/
The document discusses strategies for balancing automobile use with pedestrian and bicycle infrastructure in downtown areas. It summarizes a presentation on "putting cars in their place" which explored reducing the influence of cars and creating environments attractive to walking and biking. The presentation covered parking strategies, expanding pedestrian and bicycle networks, and case studies from various cities.
O documento apresenta os resultados de uma pesquisa sobre os tipos de fãs entre as meninas da classe 3172, mostrando que os maiores grupos eram fãs de One Direction (33%) e Justin Bieber (27%), com menor porcentagem para Demi Lovato (7%) e Selena Gomez (13%).
Prezentacja dla osób, które chciałyby zacząć swoją przygodę z testowaniem kodu JS. W prezentacji omówiłem podejście do testowania oraz przekazałem informację jakich narzędzi można użyć w testowaniu kodu oraz pokazałem jak wyglądają szablony testów oraz scenariusze testowe
The school magazine titled "High News" features a dark purple, black, blue and hot pink color scheme. The coverlines highlight exam results, school trips, charity events, and upcoming activities at the school including what's happening and the ice radio program. The main image on the cover is of a young school girl in a hallway with additional barcodes.
This document summarizes consumer behavior and demographics in Ukraine. It provides statistics on population structure, GDP, car purchases, bank deposits, income levels, and consumer spending patterns. The document also segments Ukrainian consumers into those who purchase from catalog companies, e-commerce sites, and TV shops. Catalog company consumers tend to be women living in smaller cities, while e-commerce consumers are men in large cities. TV shop consumers are impulse buyers, often women aged 35-45 in large cities. Overall, the document uses data from various research organizations to paint a picture of the Ukrainian consumer landscape.
The students are conducting a senior project to help restore oyster reefs in the Chesapeake Bay. Oysters once filtered the Bay's waters but have declined drastically due to overharvesting, disease, and pollution. The students grow baby oysters, called spat, on collected oyster shells. They will monitor the oysters' growth and later transfer the adult oysters to protected reefs to help restore the natural filtering process. The students are asking for donations of used oyster shells to support spat growth, as existing shells are needed but not readily available. Without shell donations, oyster restoration efforts and the long-term health of the Chesapeake Bay are at risk.
Carlos Romero Martinez is an automation and projects engineer interested in developing innovative processes to support companies. He has a master's degree in robotics and manufacturing and over 10 years of experience in automation engineering, project management, and research. His skills include engineering design, robotics, PLC programming, and team leadership.
This document discusses using SQLite databases in Android applications. SQLite is an embedded SQL database that does not require a separate server. It is included in the Android SDK and can be used to create and query database files. The document explains how to open a database, create tables, insert/update/delete rows using SQL queries, and retrieve data using cursors. Raw queries and simple queries can be used to perform retrieval queries on a single table. Transactions are used to commit or roll back changes to the database.
Chapter 3.pptx Oracle SQL or local Android database setup SQL, SQL-Lite, codi...TAISEEREISA
SQLite is an embedded SQL database that is included within Android applications. It allows creating, querying, and modifying a database without a separate server process. Developers can open and query a SQLite database using methods like openDatabase(), rawQuery(), execSQL(), and insert()/update()/delete(). This allows storing and retrieving application data, even when the device is offline.
The Python DB-API standard supports connecting to and interacting with many database servers like MySQL, PostgreSQL, and Oracle. To access a database, a Python module like MySQLdb must be installed. Code examples demonstrate how to connect to a MySQL database, create tables, insert/update/delete records, and handle errors according to the DB-API. Transactions ensure data integrity using atomicity, consistency, isolation, and durability properties.
I am looking for some assistance with SQLite database. I have tried se.pdfConint29
I am looking for some assistance with SQLite database. I have tried several other scenarios to no
avail. I am looking to have a table in my activity_weight_table.xml, I'm thinking recyclerview
but not sure. Also, I would need help with my login and password checking it agaisnt a database
and having these screens work together. My database should be able to Create: The user should
be able to add items to a database. Delete: The user should be able to remove items from a
database. Update: The user should be able to change the value associated with individual
database items (e.g. the number of a specific item in an inventory or the date of an event). Read:
The user should be able to view all of the database items displayed as a grid. These are my
following Java codes: MainActivity.java package com.example.weight; import
android.content.Intent; import android.os.Bundle; import android.widget.Button; import
android.widget.EditText; import androidx.appcompat.app.AppCompatActivity; public class
MainActivity extends AppCompatActivity { Button button_login, createAccount; EditText
loginUserName, loginPassword; @Override protected void onCreate(Bundle
savedInstanceState) { super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login_weight); button_login =
findViewById(R.id.button_login); loginPassword = findViewById(R.id.loginPassword);
loginUserName = findViewById(R.id.loginUserName); createAccount =
findViewById(R.id.createAccount); createAccount.setOnClickListener((view) -> {
Intent intent = new Intent(MainActivity.this, CreateAccountActivity.class);
startActivity(intent); }); button_login.setOnClickListener((view) -> { Intent
intent = new Intent(MainActivity.this, LoginActivity.class); startActivity(intent); });
} } DatabaseHelper.java package com.example.weight; import android.content.Context;
import android.database.sqlite.SQLiteDatabase; import
android.database.sqlite.SQLiteOpenHelper; public class DatabaseHelper extends
SQLiteOpenHelper { private static final String DATABASE_NAME = "UserAccounts.db";
private static final int DATABASE_VERSION = 1; public static final String
TABLE_USERS = "users"; public static final String COLUMN_ID = "id"; public static
final String COLUMN_USERNAME = "username"; public static final String
COLUMN_PASSWORD = "password"; private static final String TABLE_CREATE =
"CREATE TABLE " + TABLE_USERS + " (" + COLUMN_ID + " INTEGER
PRIMARY KEY AUTOINCREMENT, " + COLUMN_USERNAME + " TEXT, "
+ COLUMN_PASSWORD + " TEXT)"; public DatabaseHelper(Context
context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); }
@Override public void onCreate(SQLiteDatabase db) {
db.execSQL(TABLE_CREATE); } @Override public void onUpgrade(SQLiteDatabase
db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS " +
TABLE_USERS); onCreate(db); } } LoginActivity.java package com.example.weight;
import android.content.Intent; import android.database.Cursor; import
android.database.sqlite.SQLiteDatabase; import an.
In your seeking to Learn Mobile Application Programming using an Android native Language like Java, These PPTs will be helpful and amazing for You. This is the Tenth Lecture with The title of Android SQLite database.
This document provides an overview of connecting to and interacting with a CSQL database using JDBC. It discusses loading the JDBC driver, establishing a connection, and executing SQL statements like CREATE, INSERT, UPDATE, DELETE, and DROP using Statement and PreparedStatement objects. Example code is provided to demonstrate connecting to CSQL and performing common SQL operations through JDBC.
This document discusses using Python to interact with SQLite databases. It provides examples of how to connect to an SQLite database, create tables, insert/update/delete records, and query the database. Key points covered include using the sqlite3 module to connect to a database, getting a cursor object to execute SQL statements, and various cursor methods like execute(), executemany(), fetchone(), fetchall(), commit(), and close(). Example code is given for common SQLite operations like creating a table, inserting records, updating records, deleting records, and selecting records.
Jdbc example program with access and MySqlkamal kotecha
The document provides examples of using JDBC to connect to and interact with Microsoft Access and MySQL databases. It includes steps to create databases and tables in Access and MySQL, as well as code samples demonstrating how to connect to the databases using JDBC, execute queries using Statement and PreparedStatement, and retrieve and display result sets. Key aspects like loading the appropriate JDBC driver and connection strings for different databases are also explained.
Whether you’re an experienced Android developer, or you’re just getting started, you will need to think about storing data on the device. Android offers several options including relational data storage on a SQLite Database, but the APIs and examples provided by Google look like the state-of-the-art JDBC programming you did back in 1995! In this talk, you’ll learn how to use RealmDB, an elegant Object Relational database alternative to SQLite, to make database development on Android fun, easy, and testable.
Create an android app for database creation using.pptxvishal choudhary
1) This document describes how to create an Android app to perform CRUD (create, read, update, delete) operations on a SQLite database.
2) It involves creating a SQLiteOpenHelper subclass to manage the database, along with methods to insert, query, update and delete data from the database table.
3) The Android app includes layout elements like buttons and text fields, and Java code to handle button clicks and call the appropriate database methods. Validation is also added to ensure required fields are populated.
Introduction
Web Storage
WebSQL
IndexedDB
File System Access
Final Considerations
This presentation has been developed in the context of the Mobile Applications Development course, DISIM, University of L'Aquila (Italy), Spring 2015.
http://www.ivanomalavolta.com
This document describes how to connect to a database and run commands like UPDATE, INSERT, or DELETE using ADO.NET in a Visual Basic .NET console application. It explains how to create a connection string, open a connection, construct a command object specifying the SQL statement, and execute the command. Parameters can also be used in the SQL statement and values bound to the parameters when executing the command.
This document describes how to connect to a database and run commands like UPDATE, INSERT, or DELETE using ADO.NET in a Visual Basic .NET console application. It explains how to create a connection string, open a connection, construct a command object specifying the SQL statement, and execute the command. Parameters can be used in the SQL statement and values bound to the parameters when executing the command.
This document discusses different programming styles (Model A and Model B) for interacting with a database using embedded SQL in a J2ME application. Model A is used when SQL requests don't return a ResultSet, while Model B is used when requests return a ResultSet. Both styles minimize code by containing segments in a try block or DownRow() method. The document also covers SQL statements for creating, modifying and dropping database tables and indexes.
The document discusses basic JDBC programming concepts including connecting to a database, executing SQL statements using Statement, PreparedStatement, and ResultSet objects, and mapping between Java and SQL data types. Key methods for connecting to a database, executing queries and updates, retrieving results, and setting parameters in PreparedStatements are described.
Android basics – dialogs and floating activitiesinfo_zybotech
This document provides an overview of how to create dialog boxes and floating activities in Android application development. It discusses two main ways to create dialogs: using the Dialog class or its subclasses like AlertDialog, or applying a dialog theme to an Activity. Specific techniques covered include creating custom Dialogs, using AlertDialog features like buttons and lists, and managing dialogs through an Activity's lifecycle methods. The goal is to understand the different options available for displaying modal popups or secondary screens in an Android app.
Zybotech Solutions is an enthusiastic organization, which is one of the best android training institutes based in Kochi. Visit http://www.zybotech.in
This document contains code for an Android application that allows adding, editing, and deleting employee records from a SQLite database. It includes Java classes for activities like adding employees, displaying employees in a grid, and managing the database. Database tables are created for employees and departments, with a one-to-many relationship between them. Methods perform common tasks like inserting employee records, getting employee and department counts, and updating/deleting records.
This document provides an overview of using DroidDraw, a user interface designer for Android applications. It discusses how DroidDraw allows dragging and dropping widgets onto a screen layout to build a UI visually. Key aspects covered include choosing root layouts like LinearLayout, setting screen size, generating XML code from the designed UI, and exploring different tabs for layouts, properties, strings, and more. The document also provides a brief introduction to key concepts in Android like activities, services, content providers and resources.
The document provides information about an Android application development training tutorial. It discusses how to create custom buttons, color pickers, and dialog boxes in Android applications. The training covers programatically drawing custom buttons with different states, creating a color picker dialog to select colors, and using different types of dialog boxes like alerts, yes/no dialogs, and lists in apps.
This document provides a tutorial on using the accelerometer sensor in Android applications. It discusses retrieving the accelerometer sensor from the SensorManager, registering a listener, and handling sensor events to detect phone movements like shaking. Code examples are given for an AccelerometerListener interface, AccelerometerManager class to manage sensor access, and an Activity that implements the listener to detect shakes and log accelerometer data.
The *nervous system of insects* is a complex network of nerve cells (neurons) and supporting cells that process and transmit information. Here's an overview:
Structure
1. *Brain*: The insect brain is a complex structure that processes sensory information, controls behavior, and integrates information.
2. *Ventral nerve cord*: A chain of ganglia (nerve clusters) that runs along the insect's body, controlling movement and sensory processing.
3. *Peripheral nervous system*: Nerves that connect the central nervous system to sensory organs and muscles.
Functions
1. *Sensory processing*: Insects can detect and respond to various stimuli, such as light, sound, touch, taste, and smell.
2. *Motor control*: The nervous system controls movement, including walking, flying, and feeding.
3. *Behavioral responThe *nervous system of insects* is a complex network of nerve cells (neurons) and supporting cells that process and transmit information. Here's an overview:
Structure
1. *Brain*: The insect brain is a complex structure that processes sensory information, controls behavior, and integrates information.
2. *Ventral nerve cord*: A chain of ganglia (nerve clusters) that runs along the insect's body, controlling movement and sensory processing.
3. *Peripheral nervous system*: Nerves that connect the central nervous system to sensory organs and muscles.
Functions
1. *Sensory processing*: Insects can detect and respond to various stimuli, such as light, sound, touch, taste, and smell.
2. *Motor control*: The nervous system controls movement, including walking, flying, and feeding.
3. *Behavioral responses*: Insects can exhibit complex behaviors, such as mating, foraging, and social interactions.
Characteristics
1. *Decentralized*: Insect nervous systems have some autonomy in different body parts.
2. *Specialized*: Different parts of the nervous system are specialized for specific functions.
3. *Efficient*: Insect nervous systems are highly efficient, allowing for rapid processing and response to stimuli.
The insect nervous system is a remarkable example of evolutionary adaptation, enabling insects to thrive in diverse environments.
The insect nervous system is a remarkable example of evolutionary adaptation, enabling insects to thrive
How to Manage Opening & Closing Controls in Odoo 17 POSCeline George
In Odoo 17 Point of Sale, the opening and closing controls are key for cash management. At the start of a shift, cashiers log in and enter the starting cash amount, marking the beginning of financial tracking. Throughout the shift, every transaction is recorded, creating an audit trail.
Title: A Quick and Illustrated Guide to APA Style Referencing (7th Edition)
This visual and beginner-friendly guide simplifies the APA referencing style (7th edition) for academic writing. Designed especially for commerce students and research beginners, it includes:
✅ Real examples from original research papers
✅ Color-coded diagrams for clarity
✅ Key rules for in-text citation and reference list formatting
✅ Free citation tools like Mendeley & Zotero explained
Whether you're writing a college assignment, dissertation, or academic article, this guide will help you cite your sources correctly, confidently, and consistent.
Created by: Prof. Ishika Ghosh,
Faculty.
📩 For queries or feedback: [email protected]
GDGLSPGCOER - Git and GitHub Workshop.pptxazeenhodekar
This presentation covers the fundamentals of Git and version control in a practical, beginner-friendly way. Learn key commands, the Git data model, commit workflows, and how to collaborate effectively using Git — all explained with visuals, examples, and relatable humor.
A measles outbreak originating in West Texas has been linked to confirmed cases in New Mexico, with additional cases reported in Oklahoma and Kansas. The current case count is 795 from Texas, New Mexico, Oklahoma, and Kansas. 95 individuals have required hospitalization, and 3 deaths, 2 children in Texas and one adult in New Mexico. These fatalities mark the first measles-related deaths in the United States since 2015 and the first pediatric measles death since 2003.
The YSPH Virtual Medical Operations Center Briefs (VMOC) were created as a service-learning project by faculty and graduate students at the Yale School of Public Health in response to the 2010 Haiti Earthquake. Each year, the VMOC Briefs are produced by students enrolled in Environmental Health Science Course 581 - Public Health Emergencies: Disaster Planning and Response. These briefs compile diverse information sources – including status reports, maps, news articles, and web content– into a single, easily digestible document that can be widely shared and used interactively. Key features of this report include:
- Comprehensive Overview: Provides situation updates, maps, relevant news, and web resources.
- Accessibility: Designed for easy reading, wide distribution, and interactive use.
- Collaboration: The “unlocked" format enables other responders to share, copy, and adapt seamlessly. The students learn by doing, quickly discovering how and where to find critical information and presenting it in an easily understood manner.
Exploring Substances:
Acidic, Basic, and
Neutral
Welcome to the fascinating world of acids and bases! Join siblings Ashwin and
Keerthi as they explore the colorful world of substances at their school's
National Science Day fair. Their adventure begins with a mysterious white paper
that reveals hidden messages when sprayed with a special liquid.
In this presentation, we'll discover how different substances can be classified as
acidic, basic, or neutral. We'll explore natural indicators like litmus, red rose
extract, and turmeric that help us identify these substances through color
changes. We'll also learn about neutralization reactions and their applications in
our daily lives.
by sandeep swamy
How to manage Multiple Warehouses for multiple floors in odoo point of saleCeline George
The need for multiple warehouses and effective inventory management is crucial for companies aiming to optimize their operations, enhance customer satisfaction, and maintain a competitive edge.
A measles outbreak originating in West Texas has been linked to confirmed cases in New Mexico, with additional cases reported in Oklahoma and Kansas. The current case count is 817 from Texas, New Mexico, Oklahoma, and Kansas. 97 individuals have required hospitalization, and 3 deaths, 2 children in Texas and one adult in New Mexico. These fatalities mark the first measles-related deaths in the United States since 2015 and the first pediatric measles death since 2003.
The YSPH Virtual Medical Operations Center Briefs (VMOC) were created as a service-learning project by faculty and graduate students at the Yale School of Public Health in response to the 2010 Haiti Earthquake. Each year, the VMOC Briefs are produced by students enrolled in Environmental Health Science Course 581 - Public Health Emergencies: Disaster Planning and Response. These briefs compile diverse information sources – including status reports, maps, news articles, and web content– into a single, easily digestible document that can be widely shared and used interactively. Key features of this report include:
- Comprehensive Overview: Provides situation updates, maps, relevant news, and web resources.
- Accessibility: Designed for easy reading, wide distribution, and interactive use.
- Collaboration: The “unlocked" format enables other responders to share, copy, and adapt seamlessly. The students learn by doing, quickly discovering how and where to find critical information and presenting it in an easily understood manner.
CURRENT CASE COUNT: 817 (As of 05/3/2025)
• Texas: 688 (+20)(62% of these cases are in Gaines County).
• New Mexico: 67 (+1 )(92.4% of the cases are from Eddy County)
• Oklahoma: 16 (+1)
• Kansas: 46 (32% of the cases are from Gray County)
HOSPITALIZATIONS: 97 (+2)
• Texas: 89 (+2) - This is 13.02% of all TX cases.
• New Mexico: 7 - This is 10.6% of all NM cases.
• Kansas: 1 - This is 2.7% of all KS cases.
DEATHS: 3
• Texas: 2 – This is 0.31% of all cases
• New Mexico: 1 – This is 1.54% of all cases
US NATIONAL CASE COUNT: 967 (Confirmed and suspected):
INTERNATIONAL SPREAD (As of 4/2/2025)
• Mexico – 865 (+58)
‒Chihuahua, Mexico: 844 (+58) cases, 3 hospitalizations, 1 fatality
• Canada: 1531 (+270) (This reflects Ontario's Outbreak, which began 11/24)
‒Ontario, Canada – 1243 (+223) cases, 84 hospitalizations.
• Europe: 6,814
Odoo Inventory Rules and Routes v17 - Odoo SlidesCeline George
Odoo's inventory management system is highly flexible and powerful, allowing businesses to efficiently manage their stock operations through the use of Rules and Routes.
The ever evoilving world of science /7th class science curiosity /samyans aca...Sandeep Swamy
The Ever-Evolving World of
Science
Welcome to Grade 7 Science4not just a textbook with facts, but an invitation to
question, experiment, and explore the beautiful world we live in. From tiny cells
inside a leaf to the movement of celestial bodies, from household materials to
underground water flows, this journey will challenge your thinking and expand
your knowledge.
Notice something special about this book? The page numbers follow the playful
flight of a butterfly and a soaring paper plane! Just as these objects take flight,
learning soars when curiosity leads the way. Simple observations, like paper
planes, have inspired scientific explorations throughout history.
How to Set warnings for invoicing specific customers in odooCeline George
Odoo 16 offers a powerful platform for managing sales documents and invoicing efficiently. One of its standout features is the ability to set warnings and block messages for specific customers during the invoicing process.
How to Set warnings for invoicing specific customers in odooCeline George
Accessing data with android cursors
1. Android Application Development Training Tutorial
For more info visit
http://www.zybotech.in
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
2. Accessing Data With Android Cursors
What is SQLite
SQLite is an open-source server-less database engine. SQLite supports transacations and has no configuration
required. SQLite adds powerful data storage to mobile and embedded apps without a large footprint.
Creating and connecting to a database
First import android.databse.sqlite.SQLiteDatabase into your application. Then use the
openOrCreateDatabase() method to create or connect to a database. Create a new project in Eclipse called
TestingData and select the API version of your choice. Use the package name higherpass.TestingData with an
activity TestingData and click finish.
package higherpass.TestingData;
import android.app.Activity;
import android.os.Bundle;
import android.database.sqlite.SQLiteDatabase;
public class TestingData extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
SQLiteDatabase db;
db = openOrCreateDatabase(
"TestingData.db"
, SQLiteDatabase.CREATE_IF_NECESSARY
, null
);
}
}
Add the android.database.sqlite.SQLiteDatabase to the standard imports from the new project. After the
standard layout setup initialize a SQLiteDatabase variable to hold the database instance. Next use the
openOrCreateDatabase() method to open the database. The openOrCreateDatabase() method expects the
database file first, followed by the permissions to open the database with, and an optional cursor factory
builder.
Where does Android store SQLite databases?
Android stores SQLite databases in /data/data/[application package name]/databases.
sqlite3 from adb shell
bash-3.1$ /usr/local/android-sdk-linux/tools/adb devices
List of devices attached
emulator-5554 device
bash-3.1$ /usr/local/android-sdk-linux/tools/adb -s emulator-5554 shell
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
3. # ls /data/data/higherpass.TestingData/databases
TestingData.db
# sqlite3 /data/data/higherpass.TestingData/databases/TestingData.db
SQLite version 3.5.9
Enter ".help" for instructions
sqlite> .tables
android_metadata tbl_countries tbl_states
The Google Android SDK comes with a utility adb. The adb tool can be used to browse and modify the
filesystem of attached emulators and physical devices. This example is a bit ahead of where we are as we
haven't created the databases yet.
Setting database properties
There are a few database properties that should be set after connecting to the database. Use the setVersion(),
setLocale(), and setLockingEnabled() methods to set these properties. These will be demonstrated in the
creating tables example.
Creating Tables
Tables are created by executing statements on the database. The queries should be executed with the execSQL()
statement.
package higherpass.TestingData;
import java.util.Locale;
import android.app.Activity;
import android.os.Bundle;
import android.database.sqlite.SQLiteDatabase;
public class TestingData extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
SQLiteDatabase db;
db = openOrCreateDatabase(
"TestingData.db"
, SQLiteDatabase.CREATE_IF_NECESSARY
, null
);
db.setVersion(1);
db.setLocale(Locale.getDefault());
db.setLockingEnabled(true);
final String CREATE_TABLE_COUNTRIES =
"CREATE TABLE tbl_countries ("
+ "id INTEGER PRIMARY KEY AUTOINCREMENT,"
+ "country_name TEXT);";
final String CREATE_TABLE_STATES =
"CREATE TABLE tbl_states ("
+ "id INTEGER PRIMARY KEY AUTOINCREMENT,"
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
4. + "state_name TEXT,"
+ "country_id INTEGER NOT NULL CONSTRAINT "
+ "contry_id REFERENCES tbl_contries(id) "
+ "ON DELETE CASCADE);";
db.execSQL(CREATE_TABLE_COUNTRIES);
db.execSQL(CREATE_TABLE_STATES);
final String CREATE_TRIGGER_STATES =
"CREATE TRIGGER fk_insert_state BEFORE "
+ "INSERT on tbl_states"
+ "FOR EACH ROW "
+ "BEGIN "
+ "SELECT RAISE(ROLLBACK, 'insert on table "
+ ""tbl_states" voilates foreign key constraint "
+ ""fk_insert_state"') WHERE (SELECT id FROM "
+ "tbl_countries WHERE id = NEW.country_id) IS NULL; "
+ "END;";
db.execSQL(CREATE_TRIGGER_STATES);
}
}
As before open the database with openOrCreateDatabase(). Now configure the database connection with
setVersion to set the database version. The setLocale method sets the default locale for the database and
setLockingEnabled enables locking on the database. Next we setup final String variables to hold the SQLite
table creation statements and execute them with execSQL.
Additionally we manually have to create triggers to handle the foreign key relationships between the table. In a
production application there would also need to be foreign key triggers to handle row updates and deletes. The
foreign key triggers are executed with execSQL just like the table creation.
Inserting records
Android comes with a series of classes that simplify database usage. Use a ContentValues instance to create a
series of table field to data matchings that will be passed into an insert() method. Android has created similar
methods for updating and deleting records.
ContentValues values = new ContentValues();
values.put("country_name", "US");
long countryId = db.insert("tbl_countries", null, values);
ContentValues stateValues = new ContentValues();
stateValues.put("state_name", "Texas");
stateValues.put("country_id", Long.toString(countryId));
try {
db.insertOrThrow("tbl_states", null, stateValues);
} catch (Exception e) {
//catch code
}
Append this code to the previous example. First create a ContentValues object to store the data to insert and use
the put method to load the data. Then use the insert() method to perform the insert query into SQLite. The
insert() function expects three parameters, the table name, null, and the ContentValues pairs. Also a long is
returned by the insert() function. This long will hold the primary key of the inserted row.
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
5. Next we create a new ContentValues pair for the state and perform a second insert using the insertOrThrow()
method. Using insertOrThrow() will throw an exception if the insert isn't successful and must be surrounded by
a try/catch block. You'll notice that currently the application dies with an unhandled exception because the
tables we're trying to create already exist. Go back into the adb shell and attach to the SQLite database for the
application and drop the tables.
sqlite> drop table tbl_countries;
sqlite> drop table tbl_states;
Updating data
Updating records is handled with the update() method. The update() function supports WHERE syntax similar
to other SQL engines. The update() method expects the table name, a ContentValues instance similar to insert
with the fields to update. Also allowed are optional WHERE syntax, add a String containing the WHERE
statement as parameter 3. Use the ? to designate an argument replacement in the WHERE clause with the
replacements passed as an array in parameter 4 to update.
ContentValues updateCountry = new ContentValues();
updateCountry.put("country_name", "United States");
db.update("tbl_countries", updateCountry, "id=?", new String[]
{Long.toString(countryId)});
First remove the table create statements from the code. We don't need to keep creating and dropping tables.
Now create a new ContentValues instance, updateCountry, to hold the data to be updated. Then use the
update() method to update the table. The where clause in parameter 3 uses replacement of the ? with the values
stored in parameter 4. If multiple ? existed in the where statement they would be replaced in order by the values
of the array.
From the adb shell attach to the database and execute select * FROM tbl_countries; inside sqlite3.
bash-3.1$ /usr/local/android-sdk-linux/tools/adb -s emulator-5554 shell
# sqlite3 /data/data/higherpass.TestingData/databases/TestingData.db
SQLite version 3.5.9
Enter ".help" for instructions
sqlite> select * FROM tbl_countries;
1|United States
Deleting data
Once data is no longer needed it can be removed from the database with the delete() method. The delete()
method expects 3 parameters, the database name, a WHERE clause, and an argument array for the WHERE
clause. To delete all records from a table pass null for the WHERE clause and WHERE clause argument array.
db.delete("tbl_states", "id=?", new String[] {Long.toString(countryId)});
Simply call the delete() method to remove records from the SQLite database. The delete method expects, the
table name, and optionally a where clause and where clause argument replacement arrays as parameters. The
where clause and argument replacement array work just as with update where ? is replaced by the values in the
array.
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
6. Retrieving data
Retrieving data from SQLite databases in Android is done using Cursors. The Android SQLite query method
returns a Cursor object containing the results of the query. To use Cursors android.database.Cursor must be
imported.
About Cursors
Cursors store query result records in rows and grant many methods to access and iterate through the records.
Cursors should be closed when no longer used, and will be deactivated with a call to Cursor.deactivate() when
the application pauses or exists. On resume the Cursor.requery() statement is executed to re-enable the Cursor
with fresh data. These functions can be managed by the parent Activity by calling startManagingCursor().
package higherpass.TestingData;
import java.util.Locale;
import android.app.Activity;
import android.os.Bundle;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
public class TestingData extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
SQLiteDatabase db;
db = openOrCreateDatabase(
"TestingData.db"
, SQLiteDatabase.CREATE_IF_NECESSARY
, null
);
db.setVersion(1);
db.setLocale(Locale.getDefault());
db.setLockingEnabled(true);
Cursor cur = db.query("tbl_countries",
null, null, null, null, null, null);
cur.close();
}
}
Open the database as before. The query performed will return all records from the table tbl_countries. Next
we'll look at how to access the data returned.
Iterating through records
The Cursor class provides a couple of simple methods to allow iterating through Cursor data easily. Use
moveToFirst() to position the Cursor pointer at the first record then use the moveToNext() function to iterate
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
7. through the records. The isAfterLast() method performs a check to see if the cursor is pointed after the last
record. When looping through records break the loop when this becomes false.
First add the following attribute to the TextView element in the main layout. The main layout is the xml file
located at res/layouts/main.xml. We need to give this TextView element an ID that we can reference to update
the view.
android:id="@+id/hello"
Java code to iterate through entries in a cursor:
package higherpass.TestingData;
import java.util.Locale;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
public class TestingData extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView view = (TextView) findViewById(R.id.hello);
SQLiteDatabase db;
db = openOrCreateDatabase(
"TestingData.db"
, SQLiteDatabase.CREATE_IF_NECESSARY
, null
);
db.setVersion(1);
db.setLocale(Locale.getDefault());
db.setLockingEnabled(true);
Cursor cur = db.query("tbl_countries",
null, null, null, null, null, null);
cur.moveToFirst();
while (cur.isAfterLast() == false) {
view.append("n" + cur.getString(1));
cur.moveToNext();
}
cur.close();
}
}
This code simply creates a cursor querying all the records of the table tbl_countries. The moveToFirst() method
is used to position the cursor pointer at the beginning of the data set. Then loop through the records in the
cursor. The method isAfterLast() returns a boolean if the pointer is past the last record in the cursor. Use the
moveToNext() method to traverse through the records in the cursor.
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
8. Retrieving a specific record
The cursor also allows direct access to specific records.
Cursor cur = db.query("tbl_countries",
null, null, null, null, null, null);
cur.moveToPosition(0);
view.append("n" + cur.getString(1));
cur.close();
Transactions
SQLite also supports transactions when you need to perform a series of queries that either all complete or all
fail. When a SQLite transaction fails an exception will be thrown. The transaction methods are all part of the
database object. Start a transaction by calling the beginTransaction() method. Perform the queries and then call
the setTransactionSuccessful() when you wish to commit the transaction. Once the transaction is complete call
the endTransaction() function.
db.beginTransaction();
Cursor cur = null;
try {
cur = db.query("tbl_countries",
null, null, null, null, null, null);
cur.moveToPosition(0);
ContentValues values = new ContentValues();
values.put("state_name", "Georgia");
values.put("country_id", cur.getString(0));
long stateId = db.insert("tbl_states", null, values);
db.setTransactionSuccessful();
view.append("n" + Long.toString(stateId));
} catch (Exception e) {
Log.e("Error in transaction", e.toString());
} finally {
db.endTransaction();
cur.close();
}
Start off with a call to beginTransaction() to tell SQLite to perform the queries in transaction mode. Initiate a
try/catch block to handle exceptions thrown by a transaction failure. Perform the queries and then call
setTransactionSuccessful() to tell SQLite that our transaction is complete. If an error isn't thrown then
endTransaction() can be called to commit the transaction. Finally close the cursor when we're finished with it.
Built in android databases
The Android Operating-System provides several built-in databases to store and manage core phone application
data. Before external applications may access some of these data sources access must be granted in the
AndroidManifest.xml file in the root of the project. Some of the data applications can access are the
bookmarks, media player data, call log, and contact data. Contact data not covered due to changes in the API
between 1.x and 2.0 version of Android. See the Android Working With Contacts Tutorial. Android provides
built in variables to make working with the internal SQLite databases easy.
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
9. Access permissions
Before a program accesses any of the internal Android databases the application must be granted access. This
access is granted in the AndroidManifest.xml file. Before the application is installed from the market the user
will be prompted to allow the program to access this data.
<uses-permission
android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS" />
<uses-permission
android:name="com.android.broswer.permission.WRITE_HISTORY_BOOKMARKS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
These are some sample uses-permission statements to grant access to internal Android databases. These are
normally placed below the uses-sdk statement in the AndroidManifest.xml file. The first 2 grant read and write
access to the browser history and bookmarks. The third grants read access to the contacts. We'll need to grant
READ access to the bookmarks and contacts for the rest of the code samples to work.
Managed Query
Managed queries delegate control of the Cursor to the parent activity automatically. This is handy as it allows
the activity to control when to destroy and recreate the Cursor as the application changes state.
package higherpass.TestingData;
import android.app.Activity;
import android.os.Bundle;
import android.provider.Browser;
import android.widget.TextView;
import android.database.Cursor;
public class TestingData extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView view = (TextView) findViewById(R.id.hello);
Cursor mCur = managedQuery(android.provider.Browser.BOOKMARKS_URI,
null, null, null, null
);
mCur.moveToFirst();
int index = mCur.getColumnIndex(Browser.BookmarkColumns.TITLE);
while (mCur.isAfterLast() == false) {
view.append("n" + mCur.getString(index));
mCur.moveToNext();
}
}
}
The managed query functions very similar to the query function we used before. When accessing Android built
in databases you should reference them by calling the associated SDK variable containing the correct database
URI. In this case the browser bookmarks are being accessed by pointing the managedQuery() statement at
android.provider.Browser.BOOKMARKS_URI. We left the rest of the parameters null to pull all results from
the table. Then we iterate through the cursor records. Each time through the loop we append the title of the
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
10. bookmark to the TextView element. If you know the name of a column, but not it's index in the results use the
getColumnIndex() method to get the correct index. To get the value of a field use the getString() method
passing the index of the field to return.
Bookmarks
The first Android database we're going to explore is the browser bookmarks. When accessing the internal
Android databases use the managedQuery() method. Android includes some helper variables in
Browser.BookmarkColumns to designate column names. They are Browser.BookmarkColumns.TITLE,
BOOKMARK, FAVICON, CREATED, URL, DATE, VISITS. These contain the table column names for the
bookmarks SQLite table.
package higherpass.TestingData;
import android.app.Activity;
import android.os.Bundle;
import android.provider.Browser;
import android.widget.TextView;
import android.database.Cursor;
public class TestingData extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView view = (TextView) findViewById(R.id.hello);
String[] projection = new String[] {
Browser.BookmarkColumns.TITLE
, Browser.BookmarkColumns.URL
};
Cursor mCur = managedQuery(android.provider.Browser.BOOKMARKS_URI,
projection, null, null, null
);
mCur.moveToFirst();
int titleIdx = mCur.getColumnIndex(Browser.BookmarkColumns.TITLE);
int urlIdx = mCur.getColumnIndex(Browser.BookmarkColumns.URL);
while (mCur.isAfterLast() == false) {
view.append("n" + mCur.getString(titleIdx));
view.append("n" + mCur.getString(urlIdx));
mCur.moveToNext();
}
}
}
This code works as before, with the addition of limiting return columns with a projection. The projection is a
string array that holds a list of the columns to return. In this example we limited the columns to the bookmark
title (Browser.BookmarkColumns.TITLE) and URL (Browser.BookmarkColumns.URL). The projection array
is then passed into managedQuery as the second parameter.
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
11. Media Player
The Android Media-player also uses SQLite to store the media information. Use this database to find media
stored on the device. Available fields are DATE_ADDED, DATE_MODIFIED, DISPLAY_NAME,
MIME_TYPE, SIZE, and TITLE.
package higherpass.TestingData;
import android.app.Activity;
import android.os.Bundle;
import android.provider.MediaStore;
import android.provider.MediaStore.Audio.Media;
import android.widget.TextView;
import android.database.Cursor;
public class TestingData extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView view = (TextView) findViewById(R.id.hello);
String[] projection = new String[] {
MediaStore.MediaColumns.DISPLAY_NAME
, MediaStore.MediaColumns.DATE_ADDED
, MediaStore.MediaColumns.MIME_TYPE
};
Cursor mCur = managedQuery(Media.EXTERNAL_CONTENT_URI,
projection, null, null, null
);
mCur.moveToFirst();
while (mCur.isAfterLast() == false) {
for (int i=0; i<mCur.getColumnCount(); i++) {
view.append("n" + mCur.getString(i));
}
mCur.moveToNext();
}
}
}
The only differences here is that we use getColumnCount() to determine the number of columns in the returned
records and loop through displaying each column.
Call Log
If granted permission Android applications can access the call log. The call log is accessed like other
datastores.
package higherpass.TestingData;
import android.app.Activity;
import android.os.Bundle;
import android.provider.CallLog;
import android.provider.CallLog.Calls;
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
12. import android.widget.TextView;
import android.database.Cursor;
public class TestingData extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView view = (TextView) findViewById(R.id.hello);
String[] projection = new String[] {
Calls.DATE
, Calls.NUMBER
, Calls.DURATION
};
Cursor mCur = managedQuery(CallLog.Calls.CONTENT_URI,
projection, Calls.DURATION +"<?",
new String[] {"60"},
Calls.DURATION + " ASC");
mCur.moveToFirst();
while (mCur.isAfterLast() == false) {
for (int i=0; i<mCur.getColumnCount(); i++) {
view.append("n" + mCur.getString(i));
}
mCur.moveToNext();
}
}
}
This final example introduces the rest of the managedQuery() parameters. After the projection we pass a
WHERE clause in the same way they were crafted in the update and delete sections earlier. After the where
clause comes the array of replacement arguments. Finally we pass in an order by clause to tell SQLite how to
sort the results. This query only retrieves records for phone calls lasting less than 60 seconds and sorts them by
duration ascending.
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi