[android-developers] Shared Preferences

2012-10-11 Thread Mario Bat
Hi, what is the difference betweent 
PreferenceManager.getDefaultSharedPreferences and 
getSahredPreferences(String name, int mode) ?

I thought that the defaultSharedPreferences are someting like global 
preferences that every application can manipulate. So lets say that I can 
call a preference from another application in my own application, and even 
change it.
And the getSharedPreferences are preferences that I can only use in my 
application.

Thats just what I thougt it is...but I'm not sure.


-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Passing Numeric value from one activity to another through shered preference

2012-08-08 Thread Mario Bat

>
> If you want to pass it through Sahred Preference then do something like 
> this.


In activity A put your value in the shared preference:
 
SharedPreferences prefs = 
PreferenceManager.getDefaultSharedPreferences(context);
Editor editor = prefs.edit();
editor.putString("key", "value");
editor.commit();

to get the value from shared preference in activity B:

SharedPreferences sharedPrefs = 
PreferenceManager.getDefaultSharedPreferences(context);
String value = sharedPrefs.getString("key", null);

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: how to store the data in cache/temp memory

2012-08-06 Thread Mario Bat
not sure what you mean, but try looking up startyActivityForResult. Thats 
how you can get the data from B back to A. in the onActivityResult method..

 Dana ponedjeljak, 6. kolovoza 2012. 11:39:10 UTC+2, korisnik vamshi ch 
napisao je:
>
> Hi,
>
> I have an App that i want to store the data in cache/temp memory before 
> saving the data in DB like  I have created an application with 2 
> activities, where *A*  , *B* . if I go through *A -> B*, in *B* I've some 
> fields  I would like to have its data cached somewhere  then I'm back to *
> A* , then If i save the A fields in DB then only i needs to save B 
> fields.  if I'm not saving any data fields in *A* so *B* fields will not 
> be save..
>
> Until and unless saving the data in *A *then only *B* fields needs to 
> save.
>
> Can anyone help me with a code snippet. 
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Android memory allocation and static variables

2012-08-06 Thread Mario Bat
Ok...the problem is that if I unregister from GCM the app will still 
receive notifications until GCM sets it to unregistered that can wait for 
2-3 days. Thats what i heard at least...
The only way I see here is to write it to a file if its registered or not, 
and when the push comes check in the file if it is registered. You have any 
other suggestions?


Dana ponedjeljak, 6. kolovoza 2012. 13:05:54 UTC+2, korisnik Mark Murphy (a 
Commons Guy) napisao je:
>
> No, when Android terminates your process, your static data members go 
> away. A new process will be forked to run your app on the next message 
> (or when the user launches your activity, or whatever), at which point 
> your static data members will have their default values. 
>
> On Mon, Aug 6, 2012 at 7:03 AM, Mario Bat  wrote: 
> > Hi everyone, I am writing on an Android application where i am 
> registering 
> > to GCM. When I click the cehckbox to register i want to set a static 
> > variable isRegistered to true/false. Now when i receive the message I 
> want 
> > to check this variable and if it is true I make an notification. 
> > So when i get out of my app I still receive the notification and 
> everything 
> > is good. But what happens when Android deletes my application from 
> memory to 
> > free memoy? Does my static variable still exist? 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "Android Developers" group. 
> > To post to this group, send email to android-developers@googlegroups.com 
> > To unsubscribe from this group, send email to 
> > android-developers+unsubscr...@googlegroups.com 
> > For more options, visit this group at 
> > http://groups.google.com/group/android-developers?hl=en 
>
>
>
> -- 
> Mark Murphy (a Commons Guy) 
> http://commonsware.com | http://github.com/commonsguy 
> http://commonsware.com/blog | http://twitter.com/commonsguy 
>
> _The Busy Coder's Guide to Android Development_ Version 4.0 Available! 
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Android memory allocation and static variables

2012-08-06 Thread Mario Bat
Hi everyone, I am writing on an Android application where i am registering 
to GCM. When I click the cehckbox to register i want to set a static 
variable isRegistered to true/false. Now when i receive the message I want 
to check this variable and if it is true I make an notification.
So when i get out of my app I still receive the notification and everything 
is good. But what happens when Android deletes my application from memory 
to free memoy? Does my static variable still exist?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Tokens

2012-07-14 Thread Mario Bat
Hi, I'm not really familiar with tokens in general. I searched and couldnt 
find any definitions nor explanations. So what are tokens exactly, and how 
do you create them, and for what are they?
Im trying to make an app where i will send my Android device token to a 
notification push server. The server later pushes some notifications to the 
user with the device token. How do i get this token?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Tokens

2012-07-14 Thread Mario Bat
Hi, I have to make an app where i send my device token to a server. The 
server is a Push server that will push notifications to the mobile device 
later. 

My question is; What are tokens and how do you create them? Does the server 
create my token or who? I know that for the Facebook API Facebook makes the 
token for you. So does every token creation work like that? 

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en