Android Question SQLite example - edit within Grid

klaus

Expert
Licensed User
Longtime User
In the program you refer to, you can replace in the AddRow routine Dim l As Label by Dim l As EditText.
You may also need to adjust the RowHeight value in SQLTableInit et SQLTableInit1.
Then you need to add a button to update the database when EditTexts have been changed.
 
Upvote 0

Bhrt60

Member
Licensed User
Thanks Earl / Klaus

That works - well its a start anyway.

Unfortunately, the Display is a bit messed up
the text is cut off - ie. text has moved a couple of pixels up (no longer vertically centered in the cell)
I need to figure out why!

Ultimately, I don't wan't ALL columns to be editable and need work out how to detect content has changed !
Ideally NOT a button - simply moving to a new Row should save the changes

Anyway, thanks for the pointer
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
the text is cut off
This is the reason why I wrote this in my post:
You may also need to adjust the RowHeight value in SQLTableInit et SQLTableInit1.
The way to detect when an entry was updated and how you want to update the database is up to you.
Adding a button was a proposal.
 
Last edited:
Upvote 0

Bhrt60

Member
Licensed User
Thanks Klaus

I had tried changing the value before my last reply
down to 20dpi and all the way up to 230dip ! (in steps)

Unfortunately, made little or no difference so perhaps its not the row height but...

I'm using Galaxy S7 and also Bluestacks emulator
many examples look different on the emulator vs S7 !!!

I'm sure I'll figure it out but ...AAARGh!!!!!

I just bought B4A less than a week ago so still struggling with some aspects (well actually many!)
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
If you have a database stored somewhere, changing the RowHeight in the code has no effect because RowHeight is saved in the databae.
This is an 'old' project and at that time I had the bad good idea to store the setup in the database.
Now, I would save in an Init file.
You have two options.
1) If you don't need the data in the database you can uncomment this line in ACtivity_Create, this creates a new database with the new values.
' File.Delete(DBFilePath, DBFileName) ' used for testing
Don't forget to comment it again!

2) Go to the Setup screen, change the value and click on Modif.
Note: the value of RowHeigt is in pixels and not in dip values. In the example below, 200 is 50dip.

Click on .
And click on Setup.
.
Change the value and click on .
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…