Save any View at run time on Android permanetly - android-view

I am seeing the application Pulse and want to make an application like its some features. One of them is to add a new View at run time by user choice and save it . I am confused that how they did it , I mean how a View could be save at run time. Was it by SharedPreferences or other way?
If it is please help me with a piece of code of View . Thanks in advance.

yes you can do this. for this if you are creating an object on any event suppose
you are creating four buttons after clicking on button so it can be done at run time and
these objects can be saved at run time in sharedpreference object. so when you will open
next time your activity will save the objects that were in sharedprefernce object. so by
this way you can do this

Related

pass object back or pull from firebase

I have a situation where I am creating and saving objects to firebase. These can then be edited, and viewed in multiple places, or in multiple viewControllers.
I cannot decide if it is best to continually pass the whole object back and forth, so that when it is changed each view will get the most recent version.
Or, to only pass a little reference to it, or some way that each view knows which one it is dealing with, then have each view just download the most recent version from Firebase...
So central location for up/down from firebase, and pass the object locally around the App.
Or pass some reference around, and have each View up/down/observe with Firebase to stay up to date.
Does this make sense? Sorry for a very conceptual question and thank you for any input!

Changing Core Data when app starts

I am developing an iOS app which downloads xml data that are valid for 4 hours. I want to check validity and, if needed, update this data when my app starts.
I am using this xml parser to load data http://www.theappguruz.com/blog/xml-parsing-using-nsxmlparse-swift
Right now I am calling beginParse() and parsing data in AppDelegate.swift in function didiFinishLaunchingWithOptions. Is this the correct place to perform this background task?
In tutorial which I posted the guy does it in view controller but I want to use this parser to update coredata and I need it to run in background after app launches.
Thanks in advance
The professional way to do this would be have a function (or even a full class), to manage this download/parse data and asynchronously save in your core data, after that, you can inform the view that you have new content to load (or if there was an error or something).
About where to call the function, it depends...
If you should only show to the user the most updated information (like locking the screen whit a "loading..." or something like it), put the call in the first view controller, just because would be simpler to just call an completion handler to unlock and load the data.
But, if you can load the "old" information, just to be faster and refresh when the new content is available, i think that you can call in the appDelegate with no problem.

RelayJS optimistic updates that result in navigation

Lets say you have a simple app that has a "create thing" button, and when you click it, you navigate to a new URL to edit that thing. Now lets say you don't want to have to wait for the server to allocate you an ID before you show the editing interface.
What would you do? Temporarily write "new" in the URL until an ID is available, and then swap it out? Allocate an ID on the client side and hope it doesn't collide with an existing ID? Either way you would need to stop Relay from fetching information that isn't really there yet. How would you do that?
Create a second route for the new state and give it a different Relay.Container that doesn't fetch any information about this object, perhaps.
I've accomplished it by passing the viewer directly to the mutation and modifying it right there.Unlike nodes fetch from relay, the newly created node won't have the dataID property on it thus you can easily identify it in your react component.

How can I make it so that my rails app synchronizes the view to every single user that goes on it?

I am creating a rails app where users can vote on an item every 15 seconds. I want the same item to show up for every user on this website. Basically, I want each session to be synchronized in the content shown. There are two ways that I believe this can be done, but I am not totally sure about the implementation of them. One way is to define a global variable for such an item every 15 seconds. This global variable needs to be the same across all sessions on this website. Another way is to have some background process or main thread running in the back that chooses this item every 15 seconds, and each session gets the current item from this background process. Does anyone have any ideas on how I can do this? Thanks in advance!
First of all, unless you know what you're doing and have absolutely no other alternative ... Stay away from global variables.
If the thing your users are voting on is a record in a database, you already have a shared object available to all sessions at the same time. What is important here is that you ensure all of your sessions refresh their copy of that object at least every 15 seconds.
The easiest solution here would be to have a little Javascript in your page using a timeout loop to fetch a new copy of the data and update your view.

Having to agree to T&Cs on first run in Swift

I was wondering if it would be possible to programmatically make users agree to the Terms of Service I have for my application, but for them only to have to agree to it the first time they run the app straight after downloading it, as Apple requires Terms and Conditions for a social networking type application. Any help would be much appreciated as it will be one of the deciding factors on whether my app makes it to the app store or not.
Here a simple solution:
Put your to-be-called method in your delegate's application:didFinishLaunchingWithOptions, which means the T&C are shown to the user as soon as he starts the application. Then for the "once-in-a-lifetime" you could simple store a value in NSUserDefault(e.g. a string "alreadySent") at the end your custom method, which will persist over time as soon as the user doesn't delete application & data.
So the flow of event could be
App launch
Check: is the NSUserDefault value "alreadySent"?
No: Ok call method and show T&C
Yes: skip
This is a simple method which gives you a one-shot way to show the user what you want.
(Just google if you don't know how the NSUserDefault works, it's straightforward)

Resources