Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 18    Views: 55

KevinPerry
Android Fan
Profile
Posts: 199
Reg: Jan 10, 2012
Wisconsin, USA
12,890
10/13/14 08:12 PM (9 years ago)

Android, save and restore data

Hello all, Anyone get a working process for saving and restoring saved data on a screen recreate i.e. reloading page with previously, programmatically set data saved, before recreated screen? BT_fragment and others keep the normal processes that would do it, from working correctly (that I can tell). Any help would be appreciated ... thanks :-) EDITED: No not saving to cache, but saving bundle variable information.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
10/13/14 08:36 PM (9 years ago)
In iOS, you'd want to use NSUserDefaults. For Android however, "Shared Preferences" is probably what you're looking for. http://developer.android.com/guide/topics/data/data-storage.html Don't forget to 'commit' once you've finished changing property values. Cheers! -- Smug
 
KevinPerry
Android Fan
Profile
Posts: 199
Reg: Jan 10, 2012
Wisconsin, USA
12,890
like
10/13/14 10:26 PM (9 years ago)
no shared preferences ... (savedInstanceState) ... what all Android forums/sites say to use for the purpose I am working on for my plugins. No permanent storage is needed (i.e physical file creation in Android OS), I only need the variables while the app is still running. Android says to use what I posted above, in order to do what is needed. Thanks for comments
 
mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
like
10/13/14 10:38 PM (9 years ago)
Hmmm, storage for only when the app is active? Sounds like a simple object or variable would be the solution... I can't really understand the question but if your resources are getting released when you "re-create the screen" then you need to make it global.. like a property (iOS), not sure exactly how to do that in Android through, wish I could be more help. :-( Cheers, David Van Beveren http://btmods.com/chat ^ Chat with other BT members live! http://btmods.com/hire ^ Hire MrDavid for one of his services!
 
KevinPerry
Android Fan
Profile
Posts: 199
Reg: Jan 10, 2012
Wisconsin, USA
12,890
like
10/13/14 10:41 PM (9 years ago)
I think, but am not sure, that the problem is based on the BT_fragment, calling another fragment, and the activity in that fragment, not being the host fragment, but a fragment of another fragment. It currently does not let me save the data and reload it upon recreation of the screen, BT does not act as Android expects (onDestroy then recreate the screen), no OnDestroy or recreate ... in the sub-fragment itself (i.e. the plugin screen). BT_fragment, controls all of those features and the android programming to save and restore (upon certain situations) does not happen as it should in Android. So looking for the workaround to do what is needed without hacking the BT files themselves (which does work when I do that)
 
KevinPerry
Android Fan
Profile
Posts: 199
Reg: Jan 10, 2012
Wisconsin, USA
12,890
like
10/13/14 11:16 PM (9 years ago)
I am not going to post my MAJOR FINDINGS OR PROCEDURES, or I would be giving away a major part of the plugins I am creating (iOS developers do not give away all their secrets either)... another Android plugin developer is different, but to the general public ... sorry to all of you, but not happening ... if I plan on making ANYTHING off of the plugins (even a buck), I can not give away all the information to do what I am trying to do, or that would counteract all the purposes of making and selling the plugin. I will assist and help any regular Android programmer who is trying to do the same thing.
 
mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
like
10/13/14 11:30 PM (9 years ago)
Whoa buddy, no-one asked to see your project files or plugin files, we are here to help. We're discussing different methods of fixing your data issues, we're not trying to figure out your "secrets" - but we do need to know what you're trying to achieve (function wise) that's specific to the issue you're having (which you already have given, no-one is asking for any additional information). Hopefully another member can help you - @SmugWimp is our resident pro when it comes to Android, I'm sure he'll have another word or two to say on this. Best of luck, stay friendly. :-) David Van Beveren http://btmods.com/chat ^ Chat with other BT members live! http://btmods.com/hire ^ Hire MrDavid for one of his services!
 
KevinPerry
Android Fan
Profile
Posts: 199
Reg: Jan 10, 2012
Wisconsin, USA
12,890
like
10/13/14 11:44 PM (9 years ago)
@MrDavid ... Thanks for comment, no disrespect intended towards anyone, just trying to explain the problem/situation, without giving away too much of what I am doing to make my plugin 100% Android compatible. I do not want to disrespect ANY members, ... like all developers of plugins, trying to get it working so it can be added to the "plugin market". Yes, hopefully someone with some knowledge of what I am trying to do, could help me. Much respect to MrDavid or SmugWimp, ... you are two of the (many) members I look up to.
 
KevinPerry
Android Fan
Profile
Posts: 199
Reg: Jan 10, 2012
Wisconsin, USA
12,890
like
10/13/14 11:57 PM (9 years ago)
My apologies for any misunderstanding ... As a note: if anyone makes a comment, it would be seen by the general pubic, which would show the information I am requesting. I am only trying to do what the iOS developers are doing, which is making something off the plugins (to help those that are not programmers) do what is needed to complete their app. Much respect to all programmers here.
 
mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
like
10/14/14 12:04 AM (9 years ago)
Hi Kevin, No worries - your post just seemed a little unwarranted, no-one had asked to see your code or files, so it seemed a little out there when you made that post. It's okay, I'm sure it was not ill intended - just remember this is the internet and you have to be careful with words since you don't know how the tone is or the situational way of saying things. Thanks for clearing that up, and much respect right back at ya for your explanation. Also, just keep in mind that your finished code / plugin, when it goes live, people will be able to see the source code here when they download it - and sometimes that code goes public, which is inevitable when you sell your code on the internet. Not a big deal - but figured you should keep that in mind if you're worried about that kind of stuff. Anyways.. Hopefully you will find an answer to your issue soon :-) David Van Beveren http://btmods.com/chat ^ Chat with other BT members live! http://btmods.com/hire ^ Hire MrDavid for one of his services!
 
KevinPerry
Android Fan
Profile
Posts: 199
Reg: Jan 10, 2012
Wisconsin, USA
12,890
like
10/14/14 12:45 AM (9 years ago)
@MrDavid, Yes, I understand that the public will see the code upon the installation of the plugin, after it is created and released (at least for self hosters), at that point it is "public knowledge" (in my eyes, and so to speak), but until then it is my code and 'general' project, and like all other plugin developers here, I will use that information or procedure to finish the plugin for distribution. I do not want to restrict information from the general public, but do not want to also go against the regular actions of almost all the other plugin developers by giving away the coding to do what I am doing. As a note ... I will help ANY developer do what I am trying to accomplish, when dealing with the same situation. Live long and prosper :-) Kevin
 
Dusko
Veteran developer
Profile
Posts: 998
Reg: Oct 13, 2012
Beograd
22,680
like
10/14/14 12:56 AM (9 years ago)
I've sent you a PM, please have a look.
 
KevinPerry
Android Fan
Profile
Posts: 199
Reg: Jan 10, 2012
Wisconsin, USA
12,890
like
10/14/14 01:11 AM (9 years ago)
Will look, thank you. PM'd you back Dusko ... thank you.
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
10/14/14 09:03 PM (9 years ago)
some of these links may help you. https://www.dropbox.com/s/q48xawqk07fza72/AppResources.pdf?dl=0 sharedPreferences and/or sql Lite would work
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
10/14/14 09:19 PM (9 years ago)
what do you mean bt doesnt act like android?? onDestroy method, along with the others in the fragment lifecycle, dont have to be "written" in the code.they are there, just in the background. think of them as sort of like a java constructor in a class. you can override the methods to do what you want
 
KevinPerry
Android Fan
Profile
Posts: 199
Reg: Jan 10, 2012
Wisconsin, USA
12,890
like
10/15/14 07:01 AM (9 years ago)
Correct. That is where some of the coding goes to save or do things upon that specific function. Yet upon some other specific functions, the coding normally needed to do something during or after that function, is not taking affect as expected, or completely. If I remember correctly the log was showing that the class or something was not available or something when it was trying to access it, in a higher part of the architecture of BT. The BT_fragment calls are being used in the locations that I can determine it is needed. Thanks EDIT: I did get the process or coding from sites that are on your resource list.
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
10/19/14 09:54 AM (9 years ago)
OK cool can't wait to see your great product
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
10/19/14 10:13 AM (9 years ago)
Which class couldnt it access?BT or your own?
 
KevinPerry
Android Fan
Profile
Posts: 199
Reg: Jan 10, 2012
Wisconsin, USA
12,890
like
10/19/14 03:41 PM (9 years ago)
I do not recall. Been busy so no time to play. Hope to get back at it later this week.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.