I am trying to transfer two integers from my main page (latitude and longitude) to a second activity containing an instance of Google Maps that will place the marker on the lat and for a long time. My puzzle is that when I get the package in the Map_Page action, the integers that I passed are always 0, which is the default when they are Null. Does anyone see something incredibly wrong?
I have the following stored when the OnClick button is clicked.
Bundle dataBundle = new Bundle(); dataBundle.putInt("LatValue", 39485000); dataBundle.putInt("LongValue", -80142777); Intent myIntent = new Intent(); myIntent.setClassName("com.name.tlc", "com.name.tlc.map_page"); myIntent.putExtras(dataBundle); startActivity(myIntent);
Then in my map_page action, I have the following in onCreate to get the data.
Bundle extras = getIntent().getExtras(); System.out.println("Get Intent done"); if(extras !=null) { System.out.println("Let get the values"); int latValue = extras.getInt("latValue"); int longValue = extras.getInt("longValue"); System.out.println("latValue = " + latValue + " longValue = " + longValue); }
android eclipse android-intent android-activity bundle
Geeklat
source share