Retrieving Database from SQLite

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

Retrieving Database from SQLite

Postby Maxood » Thu Oct 22, 2009 5:24 pm

I need a simple example or tutorial for retrieving data from SQLite database and showing it in a TextView. Could someone refer me a link or a sample.Thank you
Maxood

"Life is an endless journey to achieve perfection"
Maxood
Developer
Developer
 
Posts: 34
Joined: Sun Aug 02, 2009 1:37 pm
Location: Karachi, Pakistan

Top

Postby nmc » Thu Oct 22, 2009 7:16 pm

searching this forum for "sqlite" results in a 10 pages list...
...want us to do the search for you? :?
nmc
Senior Developer
Senior Developer
 
Posts: 154
Joined: Thu Nov 27, 2008 8:30 pm
Location: Germany

My Queries for Database Access

Postby Maxood » Fri Oct 23, 2009 11:31 am

I am a bit confused. As i am a beginner, i need to know the following:

1. Where i will keep the SQLite database file (what path)?

2. I know that i will use import android.database.sqlite.SQLiteDatabase and import android.database.sqlite.SQLiteOpenHelper;?

3. Do i need to create a Constatns.java class as an interface for accessing the database?

Can you or someone please explain me from the very scratch? I need a simple but detailed overview of SQLite database access in android.
Maxood

"Life is an endless journey to achieve perfection"
Maxood
Developer
Developer
 
Posts: 34
Joined: Sun Aug 02, 2009 1:37 pm
Location: Karachi, Pakistan

Need Help

Postby Maxood » Fri Oct 23, 2009 5:02 pm

I have the following main.xml file and i need the code to display data from a single column in an SQLite database file in my TextView. Please provide the code.thank you


<?xml version="1.0" encoding="utf-8"?>
<ScrollView
android:id="@+id/widget54"
android:layout_width="fill_parent"
android:layout_height="fill_parent"

android:fillViewport="false"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>

<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background ="@drawable/mainscreen"
/>

<TextView

android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:text="Sex Fact 1"
android:textSize="25px"
android:paddingTop= "160px"
android:paddingLeft="25px"
android:background="@drawable/image1"
/>



<TextView

android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:text="Sex Fact 2"
android:textSize="25px"
android:paddingTop= "160px"
android:paddingLeft="25px"
android:background="@drawable/image2"
/>

<TextView
android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:text="Sex Fact 3"
android:textSize="25px"
android:paddingTop="160px"
android:paddingLeft="25px"
android:background="@drawable/image3"

/>



<TextView
android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:text="Sex Fact 4"
android:textSize="25px"
android:paddingTop="160px"
android:paddingLeft="25px"
android:background="@drawable/image4"
/>

<TextView

android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:text="Sex Fact 5"
android:textSize="25px"
android:paddingTop= "160px"
android:paddingLeft="25px"
android:background="@drawable/image5"
/>

<TextView
android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:text="Sex Fact 6"
android:textSize="25px"
android:paddingTop="160px"
android:paddingLeft="25px"
android:background="@drawable/image6"

/>



<TextView
android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:text="Sex Fact 7"
android:textSize="25px"
android:paddingTop="160px"
android:paddingLeft="25px"
android:background="@drawable/image7"
/>

<TextView

android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:text="Sex Fact 8"
android:textSize="25px"
android:paddingTop= "160px"
android:paddingLeft="25px"
android:background="@drawable/image8"
/>

<TextView
android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:text="Sex Fact 9"
android:textSize="25px"
android:paddingTop="160px"
android:paddingLeft="25px"
android:background="@drawable/image9"

/>



<TextView
android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:text="Sex Fact 10"
android:textSize="25px"
android:paddingTop="160px"
android:paddingLeft="25px"
android:background="@drawable/image10"
/>

<TextView

android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:text="Sex Fact 11"
android:textSize="25px"
android:paddingTop= "160px"
android:paddingLeft="25px"
android:background="@drawable/image11"
/>

<TextView
android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:text="Sex Fact 12"
android:textSize="25px"
android:paddingTop="160px"
android:paddingLeft="25px"
android:background="@drawable/image12"

/>



<TextView
android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:text="Sex Fact 13"
android:textSize="25px"
android:paddingTop="160px"
android:paddingLeft="25px"
android:background="@drawable/image13"
/>

<TextView

android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:text="Sex Fact 14"
android:textSize="25px"
android:paddingTop= "160px"
android:paddingLeft="25px"
android:background="@drawable/image14"
/>

<TextView
android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:text="Sex Fact 15"
android:textSize="25px"
android:paddingTop="160px"
android:paddingLeft="25px"
android:background="@drawable/image15"

/>



<TextView
android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:text="Sex Fact 16"
android:textSize="25px"
android:paddingTop="160px"
android:paddingLeft="25px"
android:background="@drawable/image16"
/>

<TextView

android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:text="Sex Fact 17"
android:textSize="25px"
android:paddingTop= "160px"
android:paddingLeft="25px"
android:background="@drawable/image17"
/>

<TextView
android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:text="Sex Fact 18"
android:textSize="25px"
android:paddingTop="160px"
android:paddingLeft="25px"
android:background="@drawable/image18"

/>



<TextView
android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:text="Sex Fact 19"
android:textSize="25px"
android:paddingTop="160px"
android:paddingLeft="25px"
android:background="@drawable/image19"
/>

<TextView

android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:text="Sex Fact 20"
android:textSize="25px"
android:paddingTop= "160px"
android:paddingLeft="25px"
android:background="@drawable/image20"
/>

<TextView
android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:text="Sex Fact 21"
android:textSize="25px"
android:paddingTop="160px"
android:paddingLeft="25px"
android:background="@drawable/image21"

/>



<TextView
android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:text="Sex Fact 22"
android:textSize="25px"
android:paddingTop="160px"
android:paddingLeft="25px"
android:background="@drawable/image22"
/>

<TextView

android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:text="Sex Fact 23"
android:textSize="25px"
android:paddingTop= "160px"
android:paddingLeft="25px"
android:background="@drawable/image23"
/>

<TextView
android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:text="Sex Fact 24"
android:textSize="25px"
android:paddingTop="160px"
android:paddingLeft="25px"
android:background="@drawable/image24"

/>



<TextView
android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:text="Sex Fact 25"
android:textSize="25px"
android:paddingTop="160px"
android:paddingLeft="25px"
android:background="@drawable/image25"
/>

<TextView

android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:text="Sex Fact 26"
android:textSize="25px"
android:paddingTop= "160px"
android:paddingLeft="25px"
android:background="@drawable/image26"
/>

<TextView
android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:text="Sex Fact 27"
android:textSize="25px"
android:paddingTop="160px"
android:paddingLeft="25px"
android:background="@drawable/image27"

/>


</LinearLayout>
</ScrollView>
Maxood

"Life is an endless journey to achieve perfection"
Maxood
Developer
Developer
 
Posts: 34
Joined: Sun Aug 02, 2009 1:37 pm
Location: Karachi, Pakistan

Postby RS » Fri Oct 23, 2009 5:29 pm

Code hard, go pro! Don't wait for someone to do your own project.
User avatar
RS
Junior Developer
Junior Developer
 
Posts: 11
Joined: Tue Oct 20, 2009 10:49 pm

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 3 guests