krakig
krakig

Reputation: 1555

Changing class variable value from an activity

I have a class which is named DataView, it is called from my Mainactivity and it draws a radar on the screen. The radar has parameters (radius, ...) that I want to be able to be changed from my ParametersActivity.

I'd like to know what's the correct way to set those parameters in the DataView so the changes on the radar are taken into account.

Should I use the SharedPreferences?

Upvotes: 3

Views: 55

Answers (1)

Ben
Ben

Reputation: 1061

In this case sharedPreferences is fine to use. It's good for settings that you want to remember etc, that's what it's for.

If you want it to restore to default on every restart of the app, maybe it would be better to just go to your ParametersActivity with startActivityForResult and return back the new radius.

Upvotes: 1

Related Questions