Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Passing Floats between activities.  RSS feed

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Im trying to pass floats from one activity to another.

The 2nd activity is opening fine but its just passing the value 0.0.

How do i get it to pass the value inside "rMainValue" - its not a constant value and can be different each time..

Sending



Receiving



Thanks.
 
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems to be being set here

Have you tried setting a break point to see what it is actually evaluating to?
 
Liam O'Connor
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, thats where its set in first activity - im trying to pass that value into the next activity.
 
Liam O'Connor
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its doing that calculation no problem, just passing the value is where im stuck..

im getting the value 0 from here..


if i change that 0 to 8 for example, i get the value 8 in 2nd activity.

How do i get whats inside "resistorValue" into the 2nd activity, and display it in "mainResistorValue"
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Liam O'Connor wrote:
im getting the value 0 from here..


if i change that 0 to 8 for example, i get the value 8 in 2nd activity.


This just proves that the value is being passed correctly.

Once again I urge you to set a break point and check what resistorValue is actually evaluating to. You might have the calculation logic correct, but the value of some variable might be wrong. eg.band3Count
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!