tag:blogger.com,1999:blog-8822648894031364992.post2748671403162179445..comments2023-10-18T00:36:26.664-07:00Comments on Android Hub 4 you : the free android programming tutorial: Image in Sqlite Database and display in a List | SqLite demo in AndroidManish Srivastavahttp://www.blogger.com/profile/11466093233081762431noreply@blogger.comBlogger208125tag:blogger.com,1999:blog-8822648894031364992.post-60764393508799374562016-09-27T02:15:10.665-07:002016-09-27T02:15:10.665-07:00Thanks a lot for this example....it is very useful...Thanks a lot for this example....it is very useful for me..kindly let me know how to save multiple images in database which is in drawable folder...but in this example only one image that is facebook will be stored and displayed...i need the guidance for saving all the images in drawable folder to database...thanks in advance;)Android NewBiehttps://www.blogger.com/profile/13511993591413990354noreply@blogger.comtag:blogger.com,1999:blog-8822648894031364992.post-91833645097865830812016-09-13T06:56:02.062-07:002016-09-13T06:56:02.062-07:00Great job you are doing out there Manish. Your exa...Great job you are doing out there Manish. Your example here holds the key to the success of a project I'm working on. how can I work with controls on this example. e.g. to use button actions to run CRUD. barughokmartin@gmail.comAnonymoushttps://www.blogger.com/profile/12293786274957003754noreply@blogger.comtag:blogger.com,1999:blog-8822648894031364992.post-4633256433740494972016-07-03T10:28:55.031-07:002016-07-03T10:28:55.031-07:00Sir,Can you fordward me image loader class file at...Sir,Can you fordward me image loader class file at deepikabgd@gmail.com<br />Thanx in adavance !!Anonymoushttps://www.blogger.com/profile/13599243482897127418noreply@blogger.comtag:blogger.com,1999:blog-8822648894031364992.post-12306281183514020892016-06-02T23:28:41.368-07:002016-06-02T23:28:41.368-07:00in this code image not shown in app.in this code image not shown in app.Anonymoushttps://www.blogger.com/profile/05395985065788434459noreply@blogger.comtag:blogger.com,1999:blog-8822648894031364992.post-35975088957620884012016-06-02T23:28:06.540-07:002016-06-02T23:28:06.540-07:00please upload correct code without any error.please upload correct code without any error.Anonymoushttps://www.blogger.com/profile/05395985065788434459noreply@blogger.comtag:blogger.com,1999:blog-8822648894031364992.post-5960041186814147752016-06-02T23:27:38.914-07:002016-06-02T23:27:38.914-07:00please upload correct code without any error.please upload correct code without any error.Anonymoushttps://www.blogger.com/profile/05395985065788434459noreply@blogger.comtag:blogger.com,1999:blog-8822648894031364992.post-79818851496832571252016-06-02T23:26:23.194-07:002016-06-02T23:26:23.194-07:00in this code image not shown in app.in this code image not shown in app.Anonymoushttps://www.blogger.com/profile/05395985065788434459noreply@blogger.comtag:blogger.com,1999:blog-8822648894031364992.post-38609323536366192362016-05-01T23:56:48.436-07:002016-05-01T23:56:48.436-07:00It is just a demo application you have to write yo...It is just a demo application you have to write your logic. There are some tip to do-<br /><br />1)Run ones app and next time comment the insert image code.<br />2)Run ones app and next time change the facebook image and text.<br />3)create a textview and imageview to take input from user so all the time image and text will be new.<br /><br />Try below url-<br />http://www.androidhub4you.com/2013/04/sqlite-example-in-android-add-image.htmlManish Srivastavahttps://www.blogger.com/profile/11466093233081762431noreply@blogger.comtag:blogger.com,1999:blog-8822648894031364992.post-75264060295575045252016-05-01T21:59:46.556-07:002016-05-01T21:59:46.556-07:00hi..
everytime i run your code, it will display mo...hi..<br />everytime i run your code, it will display more images of the same image..for example, if i run the code for second time, the image (for example, facebook) and text will appear two images of facebook with the text.<br />my question here is, how i could make the image and text just appear once only everytime i run the code?<br /><br />thanks for your advice.Anonymoushttps://www.blogger.com/profile/08116729591167677094noreply@blogger.comtag:blogger.com,1999:blog-8822648894031364992.post-29570912701803136082016-04-20T22:06:30.344-07:002016-04-20T22:06:30.344-07:00Sir i want to image update in android . so i want ...Sir i want to image update in android . so i want to save uri in database so please send me code how to save uri of image in database and find image in list typeAnonymoushttps://www.blogger.com/profile/07816639464973561249noreply@blogger.comtag:blogger.com,1999:blog-8822648894031364992.post-38931542702488029442016-02-28T21:10:17.298-08:002016-02-28T21:10:17.298-08:00Make a method to return byte array from bitmap-
db...Make a method to return byte array from bitmap-<br />db.addContact(new Contact("FaceBook", imageInByte(yourBitmap)));<br />-----------<br />public image[](){//do you task here}<br />-------------<br />And image name you have to write manually or take input from user using editbox.Manish Srivastavahttps://www.blogger.com/profile/11466093233081762431noreply@blogger.comtag:blogger.com,1999:blog-8822648894031364992.post-1676344647087161542016-02-25T06:58:24.619-08:002016-02-25T06:58:24.619-08:00good day.
how do I add multiple records with diff...good day.<br /><br />how do I add multiple records with different image names to the SQLite DB.<br />eg<br /><br />db.addContact(new Contact("FaceBook", imageInByte));<br />db.addContact(new Contact("twitter", imageInByte));Anonymoushttps://www.blogger.com/profile/06476174142924771865noreply@blogger.comtag:blogger.com,1999:blog-8822648894031364992.post-42461552805813661822016-01-27T06:42:44.388-08:002016-01-27T06:42:44.388-08:00in this demo we have image you can try below link ...in this demo we have image you can try below link too-<br />http://www.androidhub4you.com/2013/04/sqlite-example-in-android-add-image.htmlManish Srivastavahttps://www.blogger.com/profile/11466093233081762431noreply@blogger.comtag:blogger.com,1999:blog-8822648894031364992.post-33834934504083656132016-01-26T11:18:09.413-08:002016-01-26T11:18:09.413-08:00hiii can u tell me how to insert image to database...hiii can u tell me how to insert image to database only.Anonymoushttps://www.blogger.com/profile/09441170874508761254noreply@blogger.comtag:blogger.com,1999:blog-8822648894031364992.post-81710782430948865272015-07-16T19:26:55.352-07:002015-07-16T19:26:55.352-07:00Smith, I think you modified something into databas...Smith, I think you modified something into database and you did not uninstall application from your phone before re-run. Best practice, when you working on sq-lite and modified any table just uninstall the app and reinstall it again. Hope it will help you!Manish Srivastavahttps://www.blogger.com/profile/11466093233081762431noreply@blogger.comtag:blogger.com,1999:blog-8822648894031364992.post-52497869337529508752015-07-16T12:50:13.998-07:002015-07-16T12:50:13.998-07:00Hello! Thank you for this code, it is very helpful...Hello! Thank you for this code, it is very helpful! This code runs good on my emulator, but it crashes when I try it on my Samsung Galaxy s5. The error says:<br /><br />Caused by: java.lang.IllegalStateException: Couldn't read row 0, col 0 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it.<br /><br />Do you know why this could be happening? The image is quite small, only 3.28K. Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8822648894031364992.post-8270842174249628252015-06-17T22:17:01.078-07:002015-06-17T22:17:01.078-07:001)Put a delete button inside screen_list.xml
2)Ope...1)Put a delete button inside screen_list.xml<br />2)Open your ContactImageAdapter class and call the reference of delete button, like i am doing for text and image.<br />3)On press delete button get the id of row like-<br />int rowID=picture .getID(); and follow the point number 4.<br />4)Open your DATABASE Class and you will see a deleteContact method inside that, now call this method from Adapter on press press delete button and pass the rowID.<br />5)Use the notifyDataSetChanged() every time to updated the list.<br />Manish Srivastavahttps://www.blogger.com/profile/11466093233081762431noreply@blogger.comtag:blogger.com,1999:blog-8822648894031364992.post-7587443111713630442015-06-17T22:03:10.476-07:002015-06-17T22:03:10.476-07:00your code was wonderful i need a small favour from...your code was wonderful i need a small favour from you i.e how can i get the id on clicking the listview and pass this id for deletin the entire rowAnonymoushttps://www.blogger.com/profile/04066208348856487747noreply@blogger.comtag:blogger.com,1999:blog-8822648894031364992.post-1919276022014529902014-12-26T21:24:35.746-08:002014-12-26T21:24:35.746-08:00hi manish i am using your code but i got error .
i...hi manish i am using your code but i got error .<br />i have two fragment 1 for clicking the image and another for show the image . when i click the image and click the ok for save i got this error plz help ...<br /><br /><br />12-27 10:19:06.004: E/AndroidRuntime(22053): FATAL EXCEPTION: main<br />12-27 10:19:06.004: E/AndroidRuntime(22053): Process: camera.project, PID: 22053<br />12-27 10:19:06.004: E/AndroidRuntime(22053): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=65636, result=-1, data=Intent { act=inline-data (has extras) }} to activity {camera.project/camera.project.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.database.sqlite.SQLiteDatabase camera.project.DataBaseHandler.getWritableDatabase()' on a null object reference<br />12-27 10:19:06.004: E/AndroidRuntime(22053): at android.app.ActivityThread.deliverResults(ActivityThread.java:3539)<br />12-27 10:19:06.004: E/AndroidRuntime(22053): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3582)<br />12-27 10:19:06.004: E/AndroidRuntime(22053): at android.app.ActivityThread.access$1300(ActivityThread.java:144)<br />12-27 10:19:06.004: E/AndroidRuntime(22053): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1327)<br />12-27 10:19:06.004: E/AndroidRuntime(22053): at android.os.Handler.dispatchMessage(Handler.java:102)<br />12-27 10:19:06.004: E/AndroidRuntime(22053): at android.os.Looper.loop(Looper.java:135)<br />12-27 10:19:06.004: E/AndroidRuntime(22053): at android.app.ActivityThread.main(ActivityThread.java:5221)<br />12-27 10:19:06.004: E/AndroidRuntime(22053): at java.lang.reflect.Method.invoke(Native Method)<br />12-27 10:19:06.004: E/AndroidRuntime(22053): at java.lang.reflect.Method.invoke(Method.java:372)<br />12-27 10:19:06.004: E/AndroidRuntime(22053): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)<br />12-27 10:19:06.004: E/AndroidRuntime(22053): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)<br />12-27 10:19:06.004: E/AndroidRuntime(22053): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.database.sqlite.SQLiteDatabase camera.project.DataBaseHandler.getWritableDatabase()' on a null object reference<br />12-27 10:19:06.004: E/AndroidRuntime(22053): at camera.project.DataBaseHandler.addContact(DataBaseHandler.java:60)<br />12-27 10:19:06.004: E/AndroidRuntime(22053): at camera.project.TakePhotoFragment.onActivityResult(TakePhotoFragment.java:110)<br />12-27 10:19:06.004: E/AndroidRuntime(22053): at android.support.v4.app.FragmentActivity.onActivityResult(FragmentActivity.java:163)<br />12-27 10:19:06.004: E/AndroidRuntime(22053): at android.app.Activity.dispatchActivityResult(Activity.java:6135)<br />12-27 10:19:06.004: E/AndroidRuntime(22053): at android.app.ActivityThread.deliverResults(ActivityThread.java:3535)<br />12-27 10:19:06.004: E/AndroidRuntime(22053): ... 10 more<br />Anonymoushttps://www.blogger.com/profile/03949095703863543961noreply@blogger.comtag:blogger.com,1999:blog-8822648894031364992.post-58861728396473170112014-12-08T09:01:07.345-08:002014-12-08T09:01:07.345-08:00thank u so much.. but really thats not what am loo...thank u so much.. but really thats not what am looking for anyway thank u for ur help hananhttps://www.blogger.com/profile/10976566317219163302noreply@blogger.comtag:blogger.com,1999:blog-8822648894031364992.post-86047908943492185922014-12-08T08:36:39.785-08:002014-12-08T08:36:39.785-08:00You need to return an Object from your Database He...You need to return an Object from your Database Helper class and bind into listview or you can use dynamic Textview-<br />//in your database class-<br /><br />public List getAllConatct(String s) {<br /> List contactList = new ArrayList();<br /> db = sqlHp.getReadableDatabase();<br /> String selectquery = " SELECT * FROM table_contact where name=s";<br /> System.out.println("selectquery value..." + selectquery);<br /> cursor = db.rawQuery(selectquery, null);<br /><br /> while (cursor.moveToNext()) {<br /> ContactObject record = new ContactObject();<br /> record.setName(cursor.getString(cursor.getColumnIndex(NAME)));<br /> record.setNumber(cursor.getInt(cursor.getColumnIndex(NUMBER)));<br /> contactList .add(record);<br /> }<br /> cursor.close();<br /> db.close();<br /> return contactList;<br /> }<br /><br /><br />//in you activity<br /><br />Database db=new Database();<br />ArrayListcontactList;<br />contactList=db.getAllContact();<br /><br />for(int i=0;i<contactList.size();i++){<br />print(contactList.getIndex(i));<br />}Manish Srivastavahttps://www.blogger.com/profile/11466093233081762431noreply@blogger.comtag:blogger.com,1999:blog-8822648894031364992.post-53648044170242264992014-12-08T08:21:49.665-08:002014-12-08T08:21:49.665-08:00public void getContact(View v) {
EditText e = (E...public void getContact(View v) {<br /> EditText e = (EditText) findViewById(R.id.namefield);<br /> String s = e.getText().toString();<br /> Contact x = db.getContact_by_name(s);<br /> if (x!= null) {<br /> Toast.makeText(this, x.get_name() + " " + x.get_phone_number(),<br /> Toast.LENGTH_LONG).show();<br /> } this is used to show only one contact that i search for it by name but i need to know how to get for examples all contacts that have "xyz" name but this xyz name may have for example 3 different phone numbers so i need them all to be showhananhttps://www.blogger.com/profile/10976566317219163302noreply@blogger.comtag:blogger.com,1999:blog-8822648894031364992.post-24578609406611682532014-12-08T08:16:55.519-08:002014-12-08T08:16:55.519-08:00ok i know that but howe to get them on the screen...ok i know that but howe to get them on the screen in a list where many can be obtained not only the 1st namehananhttps://www.blogger.com/profile/10976566317219163302noreply@blogger.comtag:blogger.com,1999:blog-8822648894031364992.post-23638059072026688472014-12-08T08:08:03.648-08:002014-12-08T08:08:03.648-08:00I think then you can write simple query like-
sele...I think then you can write simple query like-<br />select number from student where name="xyz";Manish Srivastavahttps://www.blogger.com/profile/11466093233081762431noreply@blogger.comtag:blogger.com,1999:blog-8822648894031364992.post-17547458422587229992014-12-08T06:48:46.763-08:002014-12-08T06:48:46.763-08:00no i have onltable that contains names and phone n...no i have onltable that contains names and phone numbers <br />at the main class i have an edit text that i can put a name on it and then press on a button to search for all names and phone numbers that have the same entered name. Can u help me to write the java code of the main class and for the databasehandler ? hananhttps://www.blogger.com/profile/10976566317219163302noreply@blogger.com