Automatic Update TextView - android

I have an activity with a textview that shows different quotes every time the previous or backward button is pressed. It'd be really funny if I add 10000 quotes in the arrays.xml file and then pass it through to the textview.
Is there any method using which I can, extract text from my own blog and show quote sin the text view. what I mean is, I don't have to prompt the users to update the entire application and just do an update on the cloud and it gets updated in the app every time the user connects to the app.

Just try parsing your xml feed and show that contents into the textview. You can also use a text file and show contents of it using different indexes.

Have you had a look at the Google Cloud Messaging (GCM) service to see if this can help you? I've never looked at it, just thought I'd read somewhere about other developers that have!

Related

Is there a way to show a toast only when something has been changed in the database?

I am making an Android app in combination with a Symfony api. I use Retrofit and Room Library.
Now when I add data to the database, I navigate to another activity. Now I want to show inside this activity a toast with a message that the insertion was done successfull. How can I make sure that only a toast is shown when data is added successfull and not everytime I open the activity?
Unfortunately you need state. You need to remember what has been shown to the user already and - well - not show it if this is the case.
Having said that - I don't believe there are shortcuts. You will not get this feature for free. There will be a bit of work involved, so let's try to minimize that.
I'd probably make a counter on the device side which last message has been shown to the user. I would set the counter to the id of the last message shown. Then you would only need to always increment the counter on the server side.
This is only one way to tackle the problem. There are many others.

Can you use strikethrough text in Firebase

The title is the question, but here's a little background:
I'm making a task manager app for Android and want the user to be able to cross out tasks as they complete them onLongClick, without having to delete the task(which is already another feature). Normally, the user creates a task and I send the title, description and timeline to Firebase from that activity. Everything updates and all is well. The user can also edit and change any field in a separate activity and I am able to update Firebase just fine from that as well.
My Problem: I have it where it can successfully strikethrough the task title text for the user in my recyclerview that shows all the tasks. As soon as I push the update to Firebase, it changes the text to "androidx.appcompat.widget.AppCompatTextView{c33...", which overwrites the original text.
Without updating Firebase
After updating Firebase
I'm not sure if what I want to do is even possible. If I simply cant strikeout text and store it on my database, what would be another good alternative to accomplish the same thing? I was thinking of just changing the timeline text to "complete" or something. I just prefer the strikethrough because it looks better to me and avoids having to open the task and manually edit the time.
Databases, in general, do not store formatted text. They just store plain text. If you have some condition that you want to use to determine if text should be formatted in some way (like strikethrough), then I suggset storing another field, along with the text, that your code can use to determine how to format it. In your case, a boolean field for "complete" would be all you really need.

What is most simple way to send notification of unexpected events to users of Android application?

For example I expect this kind of situation: data in my application lost relevance and so it usless until update. And until update it have to show users some predefined message.
Is here any simple and free solution to this task?
Guess I can use some server to somehow send simple messages... but it sounds way too complicated.
If this is important I use Xamarin.
Update: main difficulty here is fact - my application can't in any way define if it's outdated or not. This may happen in random moment.
Although the requirement is not very clear I assume Update here means app update.
each time user launches app make call to an api on ur server to check if user needs to update app
If that returns true take user to a static view that says app needs update and redirects user to google play to install updates
If you want to avoid using a server, you should try Firebase (https://firebase.google.com/). More specifically, you should use Firebase Remote Config (https://firebase.google.com/features/remote-config/).
Define in a key-value pair of something like minimum_app_version_required in Firebase Remote Config. Every time user opens the your app, compare the values of app version and minimum_app_version_required that you are getting from Firebase console and show a dialog box accordingly. You can also change the value of minimum_app_version_required anytime you want.
Just set some internal flag. That when that situation occurs, you can set the flag to true and just edit whatever layout element you are using such as listView or any other element with your predefined messages saved in strings.xml. You can also build any custom pop up screen, depends how you want to show them. Let me know if you didn't understand or exactly how you want?
Need to implement versioning for this problem. To achieve this, you have to maintain a version number in server, this is the version number you app will have to save and use it to validate with server. If both are not same, then app will get the latest data from the server.

Android: how to integrate a 'report abuse' mechanism in my app.?

I'm currently working on my first serious app., and I would like to have some sort of contol on the data that users can enter.
Specifically, my app. allows users to write some text content (imagine something like a 'tweet'), and upload pictures.
I would like to prevent them from writing inappropriate text, and uploading offensive pictures for instance.
What I thought of doing, is to allow something like 'report abuse' button, where users who find some content offesive, can press - in which case relevent data will be saved, and later checked, to decide if indeed an inappropriate usage happened (maybe by some sort of server-side code).
As I said, I'm a beginner in android development, and I would really love to hear your suggestions and guiding. Perhaps it is something over my league for now? Maybe you know of such thing that already exists?
My app. uses Parse.com as its DB.
I would really appriciate your help.
Thank you.
I'm developing as well an app with parse and I also had to integrate in it a report button for the user.
The way I did it is simple:
In every Pf User object, I created a field of type counter named "reportCounter" while in the PFObject created by the user (it can be a string, a picture, etc.)I created a boolean field named "isReported". When a user find some inappropriate content he can report it through the dedicated button. The PFObject relative to that content gets its isReported field changed to YES and a parse background job checks every day for all the PFObjects, incrementing the reportCounter field of the owner-creator of the content and sending a report e-mail to the administrator. In this way you can keep also a record to see if a particular user is behaving badly. Just take a look at the Parse documentation about background-jobs. It's pretty good.
I hope this will help.

How to create message and save it in Android?

i am trying to develop a simple application. i want to create a simple message and want to save it. now, i want to select message from list of messages which i have created and stored.
can any one please suggest me or give an idea for developing the same.
Thanks in Advance
If you substitute the word "message" for "note", you are describing something really similar to the notepad example.
It runs you step by step trough the code you need to make an application that has notes (messages) you can add, and open.
If you are new to Android development you should go trough all the excersises, because it's a really good help, but if you're not you can just download the sollution and use that.
I feel you should go like this:
Have your application store Contacts in a database (I guess you're already doing this)
Have your application store messages in another database (I guess you're already doing this too)
In the UI, display all the messages inside a ListView, by querying them from your message database.
When user clicks on any message, have another screen that loads this message in full, and lets the user select the recipients
Send the text message to the selected recipients now
I just wanted to point out the flow of the app, since the storage and retrieval process os pretty straight forward. I am not sure if this was what you were looking for.
Do let me know.
If you will store little amount of data you can use sharedpreferences
http://developer.android.com/reference/android/content/SharedPreferences.html
If you want a real solution that is sqlite database that comes with android.
http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html

Categories

Resources