My app mostly works. The only problem is that when I want to delete a single item, the confirmation dialogue pops up as required and once the "yes" button is selected the app still does not delete the item.
It is getting the correct burger name. The burger's name was "hshz", quantity is 4 and price is 6. The log message was:
12-29 05:13:04.963 27316-27316/com.example.omar.burgerinventory D/TEST: Burger name is: hshz
Quantity: 4
Price: $6
The entry data is completely deleted once I hit "yes" on the confirmation dialogue. When I click the entry again, the app crashes. So this means that the data is wiped out but the list item still appears on the list for some reason. So I guess the problem here is that I'm able to delete the data but not clear it from the list.
Your problem is because you are making changes to your database correctly, assuming you are using database, but you are not updating your list adapter telling it that it's underlying data has changed..which has reference to the same old data before deleting the item..you need to fetch the new list from database after the code where you are deleting the item..
Please take a look at this accepted answer.. Android ListView not refreshing after notifyDataSetChanged
.
Also it will help if you post the code for your adapter and where you are deleting the item.
After deleting data, remove data from particular position from list by using:-
try{
al_data.remove(particular_position);
}catch(Exception e){}
notifyDataSetChanged();
You can take good example from this tutorial:
http://belencruz.com/2015/04/refresh-data-in-a-custom-android-adapter/
Related
I'm using firebase database to store data. I know how to use firebase database.
In my project I've an activity which displays a list of notices from faculties to students and by clicking on list item it will open another activity which is a chat room. In this activity student can ask question related to given notice.
Now, In first list activity I've also added on text view which displays the total number of chat messages for that particular Notice. It works well when i load data from database initially. But i want to change number of chat messages dynamically.
So, i need to listnen at chat_cnt node to update value of message_cnt text view
and problem is it is a big list so i can not use child_added for each and every notice item and if i use value_event listener than it will load all data unnecessarily at start.
The code is a little bit big so i cannot post it here. But I've described the problem.
Any answer would be appreciated, thanks. Sorry for my english :)
I'm making a app that can reserve message from php server and append new message in listView,
then mark a point on that item to show unread,of course it will disappear when click the item,
these is my question:
how can i save the read/unread mark on each item in order to when i login the app next time i
still can see the mark.
I have tried using share preference but it seems not a good solution.there is so may key to save and it's inconvenient when modify the value.
is it need SQLite ? or have easier solution? need some to help.
am trying to do .when i click a button opens another activity and shows list box. In that list box display a list of values of particular column of table. that is we have to retrieve from
sqlite database.
how to do??
like this:
http://www.google.co.in/imgres?imgurl=http%3A%2F%2Fwww.tutorialspoint.com%2Fimages%2Ftk-combobox.jpg&imgrefurl=http%3A%2F%2Fwww.tutorialspoint.com%2Fruby%2Fruby_tk_combobox.htm&docid=SVhMpjb5FMImxM&tbnid=l4yuDUmNF-lm5M&w=220&h=242&ei=HBNRUay8B8OUrgeA94CYDw&ved=0CAcQxiAwBQ&iact=ricl
Fetch the results from database
Put it in a adapter
Populate android spinner with the adapter
Use the link below for reference
http://developer.android.com/guide/topics/ui/controls/spinner.html
Answer is to big so don't possible entire code i am just giving you guide line.
Step:
You have to fetch all record in database and store into Collection class variable.
Set those variable to adapter.
You have to used onClick and get information which is require.
You can refer this tutorial may be helpful.If this is helpful then accept answer.
I was able to delete rows in the table i have created by simply clicking on the button "Delete Record". But when i am trying to add a row by clicking on the button "New Record", it displayed an error like this
so, in the preferences i have set the default value to empty string. Still it is not working and is displaying the same error. Is it possible to add like this or not? And when i create a new table, there is no problem in creating a new record. But how to add data into that row? please help me. Thank you
According to this bug report:
http://sourceforge.net/tracker/?func=detail&aid=2936194&group_id=87946&atid=584909
...this appears to be caused by a bug in the app which still isn't fixed (see comments on issue).
The last comment states they were successful in changing their preferences by creating a few registry keys where the app looks for its settings.
hi i would like to know solution for such a problem..... i have an xml file containing users data of around 1000 users listed out in alphabetical order. The xml file use to be as follow
<usersdata>
<user>
<id>1</id>
<firstname>A</firstname>
<middlename>AA</middlename>
......
......
</user>
<user>
<id>2</id>
<firstname>B</firstname>
<middlename>BB</middlename>
......
......
</user>
........
........
</usersdata>
Now from the above xml file i am parsing all the tags and storing them in an array list for each tag. I am listing out the Firstname in a listview, by array list of first name. When the any of the list is clicked, it opens up a new activity where the all other details of the selected name is been shown.
For example if third name in the list is clicked, by using its position(example 3), in the next activity i am listing out the third values stored in all the array lists i am using. This is what currently i am doing.
Now the problem is i have a edit box above the list view, named as a search box. If the letter S is typed in it, then all the names starting with S gets listed first. Opening the next activity by clicking the list now gets some wrong data, how to avoid this.
Please give me a suggestion....
For example if the first name C is clicked, it will be listed at position 3
There is a quick and dirty hack: you can store user id in the invisible field, retrieve it on click and use it as an argument for the second activity. I'm afraid I can't come up with better suggestions without seeing the code.
i tried out by setting some flag and by using an example code in developers site. And i am able to list out the data's but this idea does not full fill my apps requirement in the next activity. So i removed the search part in my app.
Sorry for posting such a question here......