how to make a list stay permanently in android - android-listview

I am new to android programming and was trying to make an app that would take some data through the edit text from the user and would return a list of it using list view.I was successful in making it,but then I realized that when I make the list and close and reopen the app,the previous list gets deleted and and I have to start all over again.So could anyone tell me how to save the list without the use of the database.
Thank you

The easiest way to save your data for further use, is creating a database.
here is a good tutorial for learning how to use database in android:
http://www.androidhive.info/2011/11/android-sqlite-database-tutorial/

Related

How to use local database for creating a fabourite button for my Flutter app?

I am developing a Quotes app as a beginner Practice project in flutter. I have multiple pages in my app. Right now I want to create an icon button which will perform as a bookmark (Mark as favourite) for the user. And in the app bar there will be a favourite option where the user can find those marked page number. And if they touch it, it will navigate to the preferred page. I am a self learner. So, kinda confused right now about which function should i use. Should I use shared preference? Or SQlite, so that I can create that function for my project? Can you please give some advice?
i think using shared preference is not good idea for solving your problem so i recommend using sqflite for your purpose and create multiple table for fetching and saving your data.

How to save properties of a listview in a list?

Okay I have a feature to implement in my flutter app. I have a list of video URL from my database on a server that shows up in a listview and plays the video when clicked, but I want to save details of the video like it's id, URL and name in a list so I can use it to make a listview of recently played videos.
I don't know how to go about this, but what I Have in mind is, when a video is clicked I somehow save those details I need to implement what I want, I also want it to be stored so the user can see it every time. I need help with this, anyone?
You have the right idea.
What you need to do is to do is create a database and have a table for the recent viewed list. So when a user clicks on the video, the details are saved into that table and they can be retrieved later on.
Flutter has several ways for you to implement a database.
You can use SQFLite, the flutter implementation of SQLITE
You can also use MOOR or HIVE.
You can check out this cookbook for how to use SQFlite

Changing text on buttons etc on mobile app which is already in production

Let's say we have a mobile app (iPhone, Android) already deployed and being used by people.
Is it possible to change text on buttons, title bars, or even shape or colour of these things without a major update? What I mean is, do we have to deploy an update to the whole app (for example, new version) in order to change one single text on the button? Or maybe these things (settings) can be stored in some kind of database or XML?
Help me out on this one please. Thanks a million.
Is it possible to change text on buttons, title bars, or even shape or colour of these things without a major update?
No. You have to deploy a new version, even if you want to change a single thing like that.
It's possible to do changes to an existing app without deploying a new version, but in your case it's not possible. This is how it works:
You create a mechanism to check for new updates.
New updates can be new data, new settings, etc.
You make your app download and use that new data.
The problem here is that you have to have already deployed an app that do the steps above. Since your app currently does not have that implemented, there's no way to do any changes to it but updating it.
You have to update your app. I implemented the consumption of a JSON string recently to display a Message of the Day periodically. It also keeps a "low watermark" that I compare against the user's running version. If their version is too old I present them with 2 options: upgrade or quit.
You could as easily make your text work in the same way. Just be sure to keep a local cache in case they don't have network access. Will require some healthy refactoring.
you are able to store the text of buttons in values/Strings.xml and set them to the controls by text="#String/text_for_buttonxy" . This is grat for multiple languages, because you are able to put the Strings.xml in a country-code ending value folder like values-de values-en or values-fr in order to get the right String based on the phonesettungs.
Vor colors you are able to to the same thing with the colors.xml.
But you won't be able to change this xml file by synchronisation with a server, this will be a litte bit more complicated, please explain how to you want to change the settings.

How to add records/objects to my Sqlite DB on version upgrade

I am quite happy with versioning and database migration. I simply have a database of running trails that I add information (more trails) on a regular basis. I want to ship these new trails on version upgrades so the users can have an ever growing list of trails to run. For example i add say 10 trails per month to the app that users who have bought the app need to get when they download the new version.
I was wondering how best to do this and cant find reference to it anywhere. Should you hardcode the adding of new information in say the ApplicationdidfinishLaunching method for example or is there a way to compare databases or not have to rely on hard coding of data which could lead to mistakes.
I could ask the users to delete their app of the phone and reinstall the new one but that is rather cumbersome and the kind of thing microsoft would do.
Thanks for your help in advance.
Willow
AFAIK there's no automation for this kind of task. I do it in this way (in applicationDidFinishLaunching):
compare lastAppVersion value from user defaults
if not set or lastAppVersion == current application version, do nothing
if lastAppVersion != current application version, migrate data from lastAppVersion to current application version
store current application version to lastAppVersion (user defaults)
It can help me to do some stuff within updates if there's no automation for a task.
If it takes longer, I do this in custom splash screen view controller to let user know what's happening or at least to show some progress bar.

wiki iphone project

I'm currently working on an iPhone project where i want to present to the user spesific terms from wikipedia. I'm facing tow difficulties right now:
1. I want the specific content to work offline.
2. I want to show the relevant pictures as well.
I need to find the most efficient way to do it, can someone advise ?
You could get the content online and cache them in the app DB. If necessary you could prepolutate the db directly in you app. That way some terms would already be available.