I am struggling to figure out how to pass an int value from one activity to another. This is the activity where I initialize the variable:
public class StartScreen extends AppCompatActivity {
// getting the start time
Calendar myDate = Calendar.getInstance();
int start = myDate.get(Calendar.DAY_OF_WEEK);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_start_screen);
}
// when clicking on start
public void startMap(View view){
...
and here is the other activity where I want to use that value:
public class MapsActivity extends FragmentActivity implements OnMapReadyCallback,
GoogleApiClient.ConnectionCallbacks,
GoogleApiClient.OnConnectionFailedListener,
LocationListener {
...
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
mMap.setMapType(GoogleMap.MAP_TYPE_TERRAIN);
// set kml layers
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
InputStream inputStream = null;
try {
// get different maps on different days of the week
switch(start) {
case Calendar.MONDAY:
...
How should I call the int start in the second activity? Does it happen by using Intent or SharedPreferences or maybe some other method?