My application starts from an Main activity and this main activity has its own onTouchListener which is in its own class and from this onTouchClass im calling an AlertDialog when the finger was removed from the screen and its working.. And from this AlertDialog i have an intent that starts activity two.
But i have two variables in the onTouch class that i will need in activity two, So i tried in my AlertDialog initiate the onTouch class and make a .putExtra for each of the variables i need.
Intent i = new Intent();
i.setClass(context, ActivityTwo.class);
i.putExtra("Value1", onTouchClass.integer1);
i.putExtra("Value2", onTouchClass.integer2);
Log.d("Info", "Value1: " + onTouchClass.integer1);
Log.d("Info", "Value2: " + onTouchClass.integer2);
context.startActivity(i);
I did logging here and its also 0,On the other side (The activity that gets started) i did this:
getValue1 = extras != null? extras.getInt("Value1"): -1;
getValue2 = extras != null? extras.getInt("value2"): -1;
Log.d("Info", "Value1: " + getValue1);
Log.d("Info", "Value2: " + getValue2);
Then im taking a look in LogCat for theese logs and it says: Value1: 0 and Value2: 0
And i know there should be a value cus in my onTouchClass i have this which checking if i have a value in it:
GeoPoint p = mapview.getProjection().fromPixels((int) e.getX(), (int) e.getY());
integer1 = p.getLatitudeE6();
integer2 = p.getLongitudeE6();
Log.d("Info", "Value1: " + integer1);
Log.d("Info", "Value2: " + integer2);
From theese logs in LogCat i do get a value.. But why isn’t it working to get this value into the other classes???
Try to pass the string value instead of onTouchClass.integer1 this integer value
check what ever the value is store in onTouchClass.integer1.
before pass to the intent print this value and check the log.