Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Pure VPN - Up to 27 Months
vgp
Updated:
Friday at 8:10 AM
එක පැකේජ් එකයි මාසෙටම Unlimited Internet. තාමත් DATA CARD දාන්න සල්ලි වියදම් කරනවද? අඩුම මිලට අපෙන්.
sayuru bandara
Updated:
Jun 2, 2026
Ad icon
ඉන්ටර්නෙට් එකෙන් හරියටම සල්ලි හොයන්න සහ Success වෙන්න කැමතිද? 🚀 (E-Money & Success Stories)
siri sumana
Updated:
May 30, 2026
Gemini AI PRO 18 months Offer
Hawaka
Updated:
May 27, 2026
Ad icon
koko account
DasunEranga
Updated:
May 27, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Help
- Android- Populating a ListView with a CursorAdapter with SQLite
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="elektro" data-source="post: 20045443" data-attributes="member: 352042"><p><span style="color: White">වර ඇතුලට </span></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">ඇන්ඩ්රොයිඩ් ඇප් ඩෙව් කරන අයගෙන් ලොකු හෙල්ප් එකක් ඕන..මම තාම අලුත් Android dev වලට. මට ඕන මචංලා list view එකකට කලින් හදලා තියෙන db (data දැනටමත් දාලා තියෙන) එකකින් data ගන්න cursoradapter එකක් යූස් කරලා.</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">මම මේ ටියුටෝරියල් එක බැලුවා. <a href="https://github.com/codepath/android_guides/wiki/Populating-a-ListView-with-a-CursorAdapter" target="_blank">https://github.com/codepath/android_guides/wiki/Populating-a-ListView-with-a-CursorAdapter</a></span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">මේකේ Retrieving the Cursor කියන තැනයි ගැටලුව තියෙන්නේ. දැනට මම DB එක Access කරන්න class එකක් හදලා තියෙන්නේ.</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">public class DBAccess {</span></p><p><span style="font-size: 18px"> private SQLiteOpenHelper openHelper;</span></p><p><span style="font-size: 18px"> private SQLiteDatabase database;</span></p><p><span style="font-size: 18px"> private static DBAccess instance;</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px"> public DBAccess(Context context) {</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px"> this.openHelper = new MyDBClass(context);</span></p><p><span style="font-size: 18px"> }</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px"> public static DBAccess getInstance(Context context) {</span></p><p><span style="font-size: 18px"> if (instance == null) {</span></p><p><span style="font-size: 18px"> instance = new DBAccess(context);</span></p><p><span style="font-size: 18px"> }</span></p><p><span style="font-size: 18px"> return instance;</span></p><p><span style="font-size: 18px"> }</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px"> public void open() {</span></p><p><span style="font-size: 18px"> this.database = openHelper.getWritableDatabase();</span></p><p><span style="font-size: 18px"> }</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px"> public void close() {</span></p><p><span style="font-size: 18px"> if (database != null) {</span></p><p><span style="font-size: 18px"> this.database.close();</span></p><p><span style="font-size: 18px"> }</span></p><p><span style="font-size: 18px"> }</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px"> </span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">}</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">මේ class එක ඇතුලට කොහොමද අපි (list view එක ගන්න ඕන query ඇතුලත්) retrieve cursor එක ලියන්නේ.</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">අනික් අය බම්ප් එකක් දාගෙන යන්න.</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px"></span></p></blockquote><p></p>
[QUOTE="elektro, post: 20045443, member: 352042"] [COLOR="White"]වර ඇතුලට [/COLOR] [SIZE="5"] ඇන්ඩ්රොයිඩ් ඇප් ඩෙව් කරන අයගෙන් ලොකු හෙල්ප් එකක් ඕන..මම තාම අලුත් Android dev වලට. මට ඕන මචංලා list view එකකට කලින් හදලා තියෙන db (data දැනටමත් දාලා තියෙන) එකකින් data ගන්න cursoradapter එකක් යූස් කරලා. මම මේ ටියුටෝරියල් එක බැලුවා. [URL="https://github.com/codepath/android_guides/wiki/Populating-a-ListView-with-a-CursorAdapter"]https://github.com/codepath/android_guides/wiki/Populating-a-ListView-with-a-CursorAdapter[/URL] මේකේ Retrieving the Cursor කියන තැනයි ගැටලුව තියෙන්නේ. දැනට මම DB එක Access කරන්න class එකක් හදලා තියෙන්නේ. public class DBAccess { private SQLiteOpenHelper openHelper; private SQLiteDatabase database; private static DBAccess instance; public DBAccess(Context context) { this.openHelper = new MyDBClass(context); } public static DBAccess getInstance(Context context) { if (instance == null) { instance = new DBAccess(context); } return instance; } public void open() { this.database = openHelper.getWritableDatabase(); } public void close() { if (database != null) { this.database.close(); } } } මේ class එක ඇතුලට කොහොමද අපි (list view එක ගන්න ඕන query ඇතුලත්) retrieve cursor එක ලියන්නේ. අනික් අය බම්ප් එකක් දාගෙන යන්න. [/SIZE] [/QUOTE]
Insert quotes…
Verification
Awruddata maasa keeyada?
Post reply
Top
Bottom