Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - Not able to read data from the shell command

Not able to read data from the shell command

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

Not able to read data from the shell command

Postby discover_dileep » Tue Nov 18, 2008 3:18 pm

Hi,
I am using +- code .I am able to diaplay the data thing on the emulator but when I am trying to see the database table using shell command,then I am not able to find the database table.
Plz help me out.
my code is :-
package com.android.hello;


import java.util.ArrayList;

import android.app.ListActivity;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.EditText;

public class DataBaseWork extends ListActivity {

private final String MY_DATABASE_NAME = "myCoolDB_2.db";
private final String MY_DATABASE_TABLE = "Users";

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);

EditText et = new EditText(this);
et.setSelection(et.getText().length());
/* Will hold the 'Output' we want to display at the end. */
ArrayList<String> results = new ArrayList<String>();

SQLiteDatabase myDB = null;
try {
/* Create the Database (no Errors if it already exists) */
myDB = this.openOrCreateDatabase(MY_DATABASE_NAME, MODE_PRIVATE, null);

/* Create a Table in the Database. */
myDB.execSQL("CREATE TABLE IF NOT EXISTS "
+ MY_DATABASE_TABLE
+ " (LastName VARCHAR, FirstName VARCHAR,"
+ " Country VARCHAR, Age INT(3));");

/* Add two DataSets to the Table. */
myDB.execSQL("INSERT INTO "
+ MY_DATABASE_TABLE
+ " (LastName, FirstName, Country, Age)"
+ " VALUES ('Gramlich', 'Nicolas', 'Germany', 20);");
myDB.execSQL("INSERT INTO "
+ MY_DATABASE_TABLE
+ " (LastName, FirstName, Country, Age)"
+ " VALUES ('Doe', 'John', 'US', 34);");

/* Query for some results with Selection and Projection. */
Cursor c = myDB.rawQuery("SELECT FirstName,Age" +
" FROM " + MY_DATABASE_TABLE
+ " WHERE Age > 10 LIMIT 7;",
null);

/* Get the indices of the Columns we will need */
int firstNameColumn = c.getColumnIndex("FirstName");
int ageColumn = c.getColumnIndex("Age");

/* Check if our result was valid. */
c.moveToFirst();
if (c != null) {
/* Check if at least one Result was returned. */
if (c.isFirst()) {
int i = 0;
/* Loop through all Results */
do {
i++;
/* Retrieve the values of the Entry
* the Cursor is pointing to. */
String firstName = c.getString(firstNameColumn);
int age = c.getInt(ageColumn);
/* We can also receive the Name
* of a Column by its Index.
* Makes no sense, as we already
* know the Name, but just to show we can */
String ageColumName = c.getColumnName(ageColumn);

/* Add current Entry to results. */
results.add("" + i + ": " + firstName
+ " (" + ageColumName + ": " + age + ")");
} while(c.moveToNext());

}
}

} finally {
if (myDB != null)
myDB.close();
}

this.setListAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, results));
}


}

thanks
dilu
discover_dileep
Developer
Developer
 
Posts: 33
Joined: Tue Oct 21, 2008 2:19 pm

Top

Postby MrSnowflake » Tue Nov 18, 2008 3:28 pm

The database should be in "/data/data/yourpackage/DataBaseWork/" or something similar.
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

i am trying the same thing

Postby discover_dileep » Tue Nov 18, 2008 5:49 pm

Hi snowflake
I am trying the same thing but still not able to get it.Please HELP ME.
THANKS
DILU
discover_dileep
Developer
Developer
 
Posts: 33
Joined: Tue Oct 21, 2008 2:19 pm

Top

Return to Networking & Database Problems

Who is online

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