Monday, April 7, 2014

Ask a question.


I use my cell phone to do the simulator, the problem does not exist in normal use.
APP just use a stored file, I found that I could not find the file.
Whether it is by phone, or through the File Explorer
eclipse on
I still can not find the cell phone can understand.
Because my phone is HTC G9.
Usually no way to see the system comes with memory files. Relevant documents can only be viewed using the SD card ES file browser.

But through the File Explorer, I have no way to find the location of the file and the corresponding applications, which makes me very tangled. Because if furnished to the simulator, you can see.
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
First, find the problem

Look at two ways to insert data

public void save (Person p)
{
SQLiteDatabase db = dbHelper.getWritableDatabase ();
db.execSQL ("insert into person (name, phone) values ​​(,)??", new Object [] {p.getName (), p.getPhone ()});
db.close ();
}

public void save (Person p)
{
SQLiteDatabase db = dbHelper.getWritableDatabase (); / / get the database operation example
ContentValues ​​values ​​= new ContentValues ​​();
values.put ("name", p.getName ());
values.put ("phone", p.getPhone ());
db.insert ("person", "name", values);
db.close ();
}

These two methods are better readability, but we noticed db.insert ("person", "name", values); operation has a name field is what does that mean?




Second, the problem

A construction method insert the

public long insert (String table, String nullColumnHack, ContentValues ​​values)



table

To insert a data table name



values ​​

ContentValues ​​object, similar to a map in the form of key-value pairs stored value through.



nullColumnHack

When the values ​​parameter is empty or when there is no content, insert will fail (the underlying database does not allow the insertion of a blank line), in order to prevent this, you want to specify a column name here, to find the time if you want to insert behavior empty row, it will be the value of this column name you specify set to null, then insert the database again. By observing the source insertWithOnConflict way to see when ContentValues ​​types of data initialValues ​​is null or size <= 0, it will add nullColumnHack set in sql statement.

If you add nullColumnHack sql end result will be similar to the statement insert into tableName () values ​​(); it is not allowed.

If you add the nullColumnHack the sql statement will become insert into tableName (nullColumnHack) values ​​(null); this is possible.
Reply:
The landlord will use adb shell commands to go see it? Directly into the / data / data / packagename / you can see your data files, etc.
Reply:
reference to the second floor lieri111 reply:
landlord will use adb shell commands go see it? Directly into the / data / data / packagename / you can see your data files, etc.

I do not know.
There document describes it? ? ? ?
Reply:
Baidu adb shell commands directly, without any documentation

No comments:

Post a Comment