Dynamic Views on Android Activity - android

I am quite new to Android development. I managed to get data saved to SQLite database. Now, what I want is to view these data when I call viewData(). I have viewData() which shows data as a Toast as I made it as a sample. Now I need these data to show on a new activity but the number of data to show is depending on how many data is in the database at the moment, If user saved 10 items then I want all the 10 items to shown up. How can I do it?
What is the best way to show data from SQLite database on an activity. Since I don't know to use ListView, I used TableLayout on the other activity where user feed data.
I hope my question is clear.
Thanks in advance.

Related

start listening #node but do not load data until data added

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 :)

Android: Storing and showing strings in ListView

I need to have a DialogFragment or similar with a ListView which contains a list of strings. I also need to have some kind of footer or something so I can add more strings to the ListView.
Basically it is a dialog where a user can specify and add endpoints to the app, and clicking on a String of the ListView would make the app connect to that endpoint.
How could I do this? Should I use a ListView with a footer? How could I store the strings in the device?
Thanks a lot in advance!
If you want to store Strings after close your app, you should use SQLite database, there you've got a nice example of use it
SQLite tutorial,
and there you could read how create a DialogFragment with ListView
DialogFragment with ListView.
To put data from database to ListView you should get List<String> someData from your database.
To add new String you could add it to database and refresh all Dialog View, or add it to list using comand someData.add(String string);
Hope I help

How to distinguish between clicked and non-clicked item in ListView in Android

I have a scenario here.I am developing a housing app in which the Complex owners can post announcements and flat owners can see it.I am using webservice.The complex owner can add a new announcement(which I am saving in my server) and the flat owners can see those announcements(I am binding the announcements headers into a list view through json parsing and on-clicking a header a full message will be displayed).
Now the problem is in case of new announcements.I want to distinguish between the readed and unreaded messages(just like in our mail).So how can I determine which listview item is clicked or which item is not clicked??And also how can I give them different colors(i.e. to mark an item unreaded or not clicked ??)
Any help will be appreciated.
Save all announcements in a table locally in sqlite. Add a column to contain the read unread flag.
While populating the list read from the table and load considering the flag.

ListView updating automatically and adding only new data items

I have a listview in which a user adds his comments on a particular topic, these are then stored on server,
as multiple users may add comment i wish the listview to update periodically (say 10sec),
and add only the latest data and not the complete data as it will slow down the application.
How do i do this.?
Fix some Buffer Comments something like 50. If the number of comments is more than 50 then display the last 50 comments only. Implement pagination concept from the server. Keep some 'Load More' button or Auto Load functionality(just like in twitter or facebook) for viewing more rows in the List.

How I can show my thousands of records in ScrollView

I am new to Android.I have stuck on one place,
I am fetching data from server that have thousand of records.I am using Limit 0,50 in my Query.SO it is showing only 50 records,But if I don't use Limit My application goes to crash.What should I do to show all my data in a List form.Is there any concept of Paging in Android or any other way.
Please suggest me the way.or links If anybody know it.
Thanks
save data fetched from server into db, using cursor to read data from db or set cache
Have you tried to use a customized list adapter ? In the getView method, use a combination of convertView + view holder, as explained here : http://chrislee.kr/wp/2011/01/01/making-the-android-ui-fast-and-efficient-by-romain-guy/

Categories

Resources