title: Temp Converter App: Fails with unknown error
body: <p>I am beginning Android programming. I have made the rough GUI for a Temperature Converter but when I run my app <strong>I get an error that is hard to determine what is wrong &amp; what point the program fails</strong> (Has anyone knowticed how vague/weird the console &amp; debugging notes are when the Android emulator/OS runs?).</p>
  
  <p>I am developing an app in Eclipse with the plugin, the Device API version is 9 (Android 2.3), I dont use xml to create &amp; layout the Views, I do it programmatically.</p>
  
  <p><em>Output from Console when error occurs:</em></p>
  
  <blockquote>
    <p>-Starting activity temperatureconv.main.TempMain on device emulator-5554<br>
    -ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=temperatureconv.main/.TempMain }<br>
    -Attempting to connect debugger to 'temperatureconv.main' on port 8675</p>
  </blockquote>
  
  <p>After this error, eclipse then opens the "Class File Editor" &amp; it says: </p>
  
  <blockquote>
    <p>Source not found<br>
    The JAR file C:/..../android.jar has no source attachment.<br>
    You can attach the source by clicking Attach Source below</p>
  </blockquote>
  
  <p>What error do you think is occuring? How can I fix this?</p>
  
  <p>My code:
          package temperatureconv.main;</p>
  
  <pre><code>import android.app.Activity;
  import android.graphics.Color;
  import android.os.Bundle;
  import android.view.ViewGroup.LayoutParams;
  import android.widget.LinearLayout;
  import android.widget.TextView;
  
  public class TempMain extends Activity 
  {
      /// Class Variables:
  
      private LinearLayout layout;
  
      /// Class Methods:
  
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) 
      {
          super.onCreate(savedInstanceState);
  
          initComponents();
  
          setContentView( layout );  // is this the correct way to set the main panel/view (remember I am not using the XML layout way)?
               // Can I use System.out.println(); in a google app, or will that crash it?
               // coz I get some funny errors when I do use it.
      }
  
  
      /**
       * Create &amp; initialise all application components
       * 
       * @return True if the application components &amp; facade were successfully created
       */
      public boolean initComponents()
      {
          layout          = new LinearLayout( this );
          TextView celLbl = new TextView( this );
          TextView fahLbl = new TextView( this );
          TextView celTxt = new TextView( this );
          TextView fahTxt = new TextView( this );
  
  
          // Set Component data
          celLbl.setText( "Celsius: " );
          fahLbl.setText( "Fahrenheit: " );
          celTxt.setText( "0" );
          fahTxt.setText( "32" );
          layout.setBackgroundColor( Color.BLUE );
          celTxt.setBackgroundColor( Color.WHITE );
          fahTxt.setBackgroundColor( Color.WHITE );
  
          layout.addView( celLbl );
          layout.addView( fahLbl );
          layout.addView( celTxt );
          layout.addView( fahTxt );
  
          celLbl.setLayoutParams( new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT) );
          fahLbl.setLayoutParams( new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT) );
          celTxt.setLayoutParams( new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT) );
          fahTxt.setLayoutParams( new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT) );
  
          return true;
      }
  }
  </code></pre>