title: Using GPS Value in View
body: <p>I'm having an issue taking a max speed value (recorded via GPS) from my application and using that value for my analog gauge view output.  When running I receive a FC "unable to expand the view".  I can enter a static value without any issue.  I am attempting to pull the max speed value (mHighestSpeedNumber) from another view (GraphCanvas.java) used for a graph which works fine. In (Analogspeed.java) where I would like to place the value, I import my variable and place the following code which no syntax errors: </p>
  
  <pre><code>private float speedvalue = (float) Double.parseDouble(mHighestSpeedNumber.toString());
  private float handTarget = speedvalue;
  </code></pre>
  
  <p>Upon doing this I then get the force close when calling the activity.</p>
  
  <p>Any help would be appreciated.  I have tried many scenarios and searched with no solution yet.  </p>
  
  <p>I believe part of the issue may be converting a double value to a float which it needs to be.  Please let me know if any other information is needed.</p>
  
  <p>Thanks</p>
  
  <p>GraphCanvas.java</p>
  
  <pre><code>mHighestSpeedNumber = mUnits.conversionFromMetersPerSecond( calc.getMaxSpeed() );
  </code></pre>
  
  <p>Analogspeed.java</p>
  
  <pre><code>package com.datamonkey.android.test;
  
  import java.text.DecimalFormat;
  import java.text.NumberFormat;
  
  import com.datamonkey.android.test.actions.utils.GraphCanvas;
  import com.datamonkey.android.test.actions.utils.StatisticsCalulator;
  import com.datamonkey.android.test.actions.Statistics;
  import com.datamonkey.android.test.util.UnitsI18n;
  
  import android.view.View;
  
  public final class AnalogSpeed extends View {
  
  private static final String TAG = AnalogSpeed.class.getSimpleName();
  
  private GraphCanvas mHighestSpeedNumber;
  
  // scale configuration
  private static final int totalNicks = 65;
  // number values for gauge
  private static final float degreesPerNick = 270.0f / totalNicks;    
  private static final int centerDegree = 0; // the one in the top center (12 o'clock)
  private static final int minDegrees = 0;
  private static final int maxDegrees = 200;
  
  // hand dynamics -- all are angular expressed in F degrees
  private boolean handInitialized = false;
  
  // Starting Position of hand
  private float handPosition = centerDegree;
  
  
  private float speedvalue = (float) Double.parseDouble(mHighestSpeedNumber.toString());
  
  private float handTarget = speedvalue;
  </code></pre>
  
  <p>Logcat</p>
  
  <pre><code>08-09 21:52:29.511: INFO/ActivityManager(60): Starting activity: Intent { dat=content://com.datamonkey.android.test/tracks/1 cmp=com.datamonkey.android.test/.actions.Statistics }
  08-09 21:52:29.719: DEBUG/AndroidRuntime(363): Shutting down VM
  08-09 21:52:29.719: WARN/dalvikvm(363): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
  08-09 21:52:29.790: ERROR/AndroidRuntime(363): FATAL EXCEPTION: main
  08-09 21:52:29.790: ERROR/AndroidRuntime(363): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.datamonkey.android.test/com.datamonkey.android.test.actions.Statistics}: android.view.InflateException: Binary XML file line #16: Error inflating class com.datamonkey.android.test.AnalogSpeed
  08-09 21:52:29.790: ERROR/AndroidRuntime(363):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
  08-09 21:52:29.790: ERROR/AndroidRuntime(363):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
  08-09 21:52:29.790: ERROR/AndroidRuntime(363):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
  08-09 21:52:29.790: ERROR/AndroidRuntime(363):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
  08-09 21:52:29.790: ERROR/AndroidRuntime(363):     at android.os.Handler.dispatchMessage(Handler.java:99)
  08-09 21:52:29.790: ERROR/AndroidRuntime(363):     at android.os.Looper.loop(Looper.java:123)
  08-09 21:52:29.790: ERROR/AndroidRuntime(363):     at android.app.ActivityThread.main(ActivityThread.java:4627)
  08-09 21:52:29.790: ERROR/AndroidRuntime(363):     at java.lang.reflect.Method.invokeNative(Native Method)
  08-09 21:52:29.790: ERROR/AndroidRuntime(363):     at java.lang.reflect.Method.invoke(Method.java:521)
  08-09 21:52:29.790: ERROR/AndroidRuntime(363):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
  08-09 21:52:29.790: ERROR/AndroidRuntime(363):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
  08-09 21:52:29.790: ERROR/AndroidRuntime(363):     at dalvik.system.NativeStart.main(Native Method)
  08-09 21:52:29.790: ERROR/AndroidRuntime(363): Caused by: android.view.InflateException: Binary XML file line #16: Error inflating class com.datamonkey.android.test.AnalogSpeed
  08-09 21:52:29.790: ERROR/AndroidRuntime(363):     at android.view.LayoutInflater.createView(LayoutInflater.java:513)
  08-09 21:52:29.790: ERROR/AndroidRuntime(363):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
  08-09 21:52:29.790: ERROR/AndroidRuntime(363):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
  08-09 21:52:29.790: ERROR/AndroidRuntime(363):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
  08-09 21:52:29.790: ERROR/AndroidRuntime(363):     at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
  08-09 21:52:29.790: ERROR/AndroidRuntime(363):     at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
  08-09 21:52:29.790: ERROR/AndroidRuntime(363):     at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
  08-09 21:52:29.790: ERROR/AndroidRuntime(363):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
  08-09 21:52:29.790: ERROR/AndroidRuntime(363):     at android.app.Activity.setContentView(Activity.java:1647)
  08-09 21:52:29.790: ERROR/AndroidRuntime(363):     at com.datamonkey.android.test.actions.Statistics.onCreate(Statistics.java:196)
  08-09 21:52:29.790: ERROR/AndroidRuntime(363):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
  08-09 21:52:29.790: ERROR/AndroidRuntime(363):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
  08-09 21:52:29.790: ERROR/AndroidRuntime(363):     ... 11 more
  08-09 21:52:29.790: ERROR/AndroidRuntime(363): Caused by: java.lang.reflect.InvocationTargetException
  08-09 21:52:29.790: ERROR/AndroidRuntime(363):     at com.datamonkey.android.test.AnalogSpeed.&lt;init&gt;(AnalogSpeed.java:135)
  08-09 21:52:29.790: ERROR/AndroidRuntime(363):     at java.lang.reflect.Constructor.constructNative(Native Method)
  08-09 21:52:29.790: ERROR/AndroidRuntime(363):     at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
  08-09 21:52:29.790: ERROR/AndroidRuntime(363):     at android.view.LayoutInflater.createView(LayoutInflater.java:500)
  08-09 21:52:29.790: ERROR/AndroidRuntime(363):     ... 22 more
  08-09 21:52:29.790: ERROR/AndroidRuntime(363): Caused by: java.lang.NullPointerException
  08-09 21:52:29.790: ERROR/AndroidRuntime(363):     ... 26 more
  08-09 21:52:30.020: WARN/ActivityManager(60):   Force finishing activity com.datamonkey.android.test/.actions.Statistics
  08-09 21:52:30.028: WARN/ActivityManager(60):   Force finishing activity com.datamonkey.android.test/.viewer.LoggerMap
  08-09 21:52:30.589: WARN/ActivityManager(60): Activity pause timeout for HistoryRecord{44f82078 com.datamonkey.android.test/.actions.Statistics}
  </code></pre>