java


How do we get and set same Toggle value while navigating from one screen(activity) to another activity?


My question is like in my activity 2 i have the screen like below.
I am toggling two or more toggle button (activity 2) and going back(arrow) to activity 1.
Now My question is how to save those value when navigating from activity 1 to activity 2 again for the second time with two or more toggle off.
This is a very general Scenario in Android UI flow:
One way could be saving toggle state in Shared preferences as explained here:
You can save the toggle state in onPause() of Activity in Shared preferences and restore the saved values in onResume() of the Activity
you can transfer infomation from activity1 to activity2 by using intent and bundle
-------------------Activity1---------------click
Intent intent = new Intent(this, Activity2.class);
intent.putExtra("Text", mText);
intent.putExtra("TextColor", mTextColor);
intent.putExtra("TextSize", mTextSize);
intent.putExtra("TextBold", mTextBold);
startActivity(intent);
-----------------------------Activity2--------------oncreate
Bundle extras = getIntent().getExtras();
mText = extras.getString("Text");
mTextColor = extras.getInt("TextColor");
mTextSize = extras.getFloat("TextSize");
mTextBold = extras.getBoolean("TextBold");
in your app, getBoolean is ok

Related Links

How to add auto increment coloumn in Oracle and access with java?
why is it not possible to throw checked Exception in java 8 forEach with lambda [duplicate]
If Java is Strongly typed then why does this code compile? [closed]
Unauthorized error while trying to intercept Retrofit request
How to add OJDBC6.jar in build.gradle file?
where I need to add “wait.ignoring” to “ExpectedConditions.visibilityOfElementLocated”
Most efficient way to retrieve key from value in a Hashmap without using BiMap
Get string from #Test annotation TestNG
Check for wrapped elements in JavaFX-FlowPane
Java ProcessBuilder: stream closed
Java lists and class inheritance
Issue with activities?
Generic error: “Error uploading to the iTunes Store” in submission
Calculator and using arrays
How do I get an aggregated list of external dependencies of my maven project?
System.out.printf method throws a flags exception

Categories

HOME
listview
plone
hashmap
session
graphql
electronics
sqlite3
cross-browser
pivotal-cloud-foundry
slick-slider
rascal
php-7.1
clearcase-ucm
fatal-error
invantive-sql
crystal-reports-2008
jprofiler
zapier
xlsxwriter
accessor
google-search-api
mmap
icloud-api
apache-commons-io
semantic-analysis
uninstall
libssl
google-cloud-nl
newline
bosh
http-status-code-503
.net-4.0
code-contracts
ghost4j
git-merge
gesture
sencha-touch-2.3
python-c-api
tropo
darcs
knockout-components
qtwebview
pillow
gcsfuse
vtigercrm
ctest
mathematica-frontend
django-debug-toolbar
mongocsharpdriver
websitepanel
lttng
essence
packagist
xpath-1.0
icu4j
computer-algebra-systems
cakephp-3.1
php-ci
angular-local-storage
streambase
apache-commons-net
fscommand
modalpopup
markers
internet-connection
sgen
yorick
didselectrowatindexpath
intentservice
multiprocessor
access-rights
jmapviewer
easy-install
sabredav
enterprisedb
funscript
dsn
objective-c-2.0
buildr
pendrive
bigcouch
eclipse-templates
window-management
gcj
rfc1123
krl
oncheckedchanged
jmock
digest-authentication
.nettiers
perfect-hash
libs
exchange-server-2003
javap
signal-handling

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App