Win a copy of Getting started with Java on the Raspberry Pi this week in the Raspberry Pi forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Liutauras Vilda
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Piet Souris

How do I make a functioning save button in Android Studio?

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey guys! I'm trying to make a simple button that will save my data on an application when I use it once more. Google doesn't seem to give me simple tutorials on how to do this. That is why I'm asking here. Also, the language I'm using is Java on Android Studio IDE.
 
Bartender
Posts: 667
14
TypeScript Fedora
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Post what you have
 
Saloon Keeper
Posts: 7520
172
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch.

On Android (as well as iOS) you generally don't use save buttons - data is saved automatically, usually from the Activity's onPause handler.

There are various ways to store data persistently; which is the most appropriate one depends on the amount of data. For key/value data, shared preferences might work. For regular data, possibly the built-in SQLite database via the Room library. Even files are a possibility, although I would advise against those.
 
Ranch Hand
Posts: 605
11
Android Python Open BSD VI Editor Slackware
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sixto Vargas wrote:Hey guys! I'm trying to make a simple button that will save my data on an application when I use it once more. Google doesn't seem to give me simple tutorials on how to do this. That is why I'm asking here. Also, the language I'm using is Java on Android Studio IDE.


room or real looks as the way to go indeed, follow a room tutorial, then a button tutorial and connect the dots
 
Once upon a time there were three bears. And they were visted by a golden haired tiny ad:
Low Tech Laboratory
https://www.kickstarter.com/projects/paulwheaton/low-tech-0
reply
    Bookmark Topic Watch Topic
  • New Topic