简体   繁体   中英

How to save sequence number state across multiple invocations of an Android app?

I am working on an Android printing application that works with a thermal printer. The app works well (prints desired output). However, I am not sure how to set the running number (sequence number) for the receipt. For example, Running number start from 001 -> 002 -> 003. Once I close my application and restart it, it starts over with 001 -> 002 and so on. I would like the running number to continue from the last used number even if the app is closed and restarted. How can I achieve this?

You Can Save the last receipt number in sharedpref or sqlite or file, Then retrieve the same and start the receipt number....

Refer Shared Pref - https://developer.android.com/training/basics/data-storage/shared-preferences.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM