Sunday, 11 August 2013

Wrong values after passing from another activity using intent

Wrong values after passing from another activity using intent

I'm passing two ints from one activity to another as part of a variable of
my own class.
The problem is that the values are supposed to be 0,0 but it shows some
random numbers like 126435,4.
the structure of my class (item):
public class item implements Parcelable {
private int id;
private String title;
private String desc;
private double lat;
private double lon;
private String pub;
private int p;
private int n;
//private int cat;
public item(int id, String title, String desc, double lat, double lon,
String pub, int p, int n) {
super();
this.id = id;
this.title = title;
this.desc = desc;
this.lat = lat;
this.lon = lon;
this.pub = pub;
this.p = p;
this.n = n;
//this.cat=cat;
}
Putting the extra variable (item): (I'ts correct. I've checked it and it
returns 0,0 as it is:
Intent.putExtra("thing",markers.get(i));
startActivity(Intent);
But as it passes and I use SetText to set it into a textView, it shows
some random numbers, whom I have no idea where they came from:
positive.setText(item.getP()+"");
negative.setText(item.getN()+"");
Then Im getting the item from the intent Extra:
item = getIntent().getParcelableExtra("thing");
the Logcat:
08-12 00:08:53.181: D/dalvikvm(5093): GC_CONCURRENT freed 459K, 19% free
12879K/15751K, paused 13ms+6ms, total 58ms
08-12 00:08:53.661: D/ProgressBar(5093): setProgress = 0
08-12 00:08:53.661: D/ProgressBar(5093): setProgress = 0, fromUser = false
08-12 00:08:53.661: D/ProgressBar(5093): mProgress = 0mIndeterminate =
false, mMin = 0, mMax = 100
08-12 00:08:53.661: D/ProgressBar(5093): setProgress = 0
08-12 00:08:53.661: D/ProgressBar(5093): setProgress = 0, fromUser = false
08-12 00:08:53.661: D/ProgressBar(5093): mProgress = 0mIndeterminate =
false, mMin = 0, mMax = 100
08-12 00:08:53.821: W/SurfaceView(5093): CHECK surface infomation
creating=false formatChanged=false sizeChanged=false visible=false
visibleChanged=true surfaceChanged=true realSizeChanged=false
redrawNeeded=true left=false top=false
08-12 00:08:54.672: D/dalvikvm(5093): GC_FOR_ALLOC freed 1111K, 21% free
12489K/15751K, paused 60ms, total 60ms
08-12 00:08:55.493: I/Async-Example(5093): onPostExecute Called
Thanks guys!

No comments:

Post a Comment