troubleshooting Question

Java Error - Source Not found (Edit Source Lookup Path)

Avatar of lulubell-b
lulubell-b asked on
Java
7 Comments1 Solution2739 ViewsLast Modified:
Hello,

I'm new to Android development and I'm running into errors that I can't figure out when running the application. I'm getting Source Not found when running debug in eclipse.

Please help. I attached the code that I'm running.
package com.CSV.Buescher;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import android.util.Log;


public class OptionsPricingCalculatorActivity extends Activity {
    /** Called when the activity is first created. */
	Button myButton;
	TextView myStockPrice;
	TextView myExercise;
	TextView myDaysToExp;
	TextView myTreasuryReturn;
	TextView myVolatility;
	EditText myD1;
	EditText myD2;
	EditText myCallValue;
	EditText myPutValue;
	String sSP; //Stock Price String
	Double dSP; //Stock Price Double
	String sEX; //Exercise String
	Double dEX; //Exercise Double
	String sDTE; //Days To Expiration String
	Double dDTE; //Days To Expiration Double
	String sTR; //Treasury Return String
	Double dTR; //Treasury Return Double
	String sVL; //Volatility String
	Double dVL; //Volatility Double
	String sD1; //D1 String
	Double dD1; //D1 Double
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        myStockPrice = (TextView)findViewById(R.id.txtStockPrice);
        myExercise = (TextView)findViewById(R.id.txtExercise);
        myDaysToExp = (TextView)findViewById(R.id.txtDaysToExp);
        myTreasuryReturn = (TextView)findViewById(R.id.txtTreasuryReturn);
        myVolatility = (TextView)findViewById(R.id.txtVolatility);
        myD1 = (EditText)findViewById(R.id.lbld1);
        myD2 = (EditText)findViewById(R.id.lbld2);
        myCallValue = (EditText)findViewById(R.id.lblCallValue);
        myPutValue = (EditText)findViewById(R.id.lblPutValue);
        
        myButton.setOnClickListener(new View.OnClickListener(){
        	public void onClick(View v){
        		if (myStockPrice.getText().toString().equals("")){
        			Toast toast = Toast.makeText(getApplicationContext(), "Please enter a value for Stock Price.", Toast.LENGTH_LONG);
        			toast.show();
        		}
        		else if (myExercise.getText().toString().equals("")){
        			Toast toast = Toast.makeText(getApplicationContext(), "Please enter a value for Exercise Price.", Toast.LENGTH_LONG);
        			toast.show();
        		}
        		else if (myDaysToExp.getText().toString().equals("")){
        			Toast toast = Toast.makeText(getApplicationContext(), "Please enter a value for Days to Expiration.", Toast.LENGTH_LONG);
        			toast.show();
        		}
        		else if (myTreasuryReturn.getText().toString().equals("")){
        			Toast toast = Toast.makeText(getApplicationContext(), "Please enter a value for Treasury Return.", Toast.LENGTH_LONG);
        			toast.show();
        		}
        		else if (myVolatility.getText().toString().equals("")){
        			Toast toast = Toast.makeText(getApplicationContext(), "Please enter a value for Volatility.", Toast.LENGTH_LONG);
        			toast.show();
        		}
        		else{
        			sSP=myStockPrice.getText().toString();
        			dSP=Double.parseDouble(sSP);
        			sEX=myExercise.getText().toString();
        			dEX=Double.parseDouble(sEX);
        			sDTE=myDaysToExp.getText().toString();
        			dDTE=Double.parseDouble(sDTE);
        			sTR=myTreasuryReturn.getText().toString();
        			dTR=Double.parseDouble(sTR);
        			sVL=myVolatility.getText().toString();
        			dVL=Double.parseDouble(sVL);
        			
        			dD1 = ((Math.log(dSP/dEX)) + (dTR + 0.5*dVL*dVL)*(dDTE/365))/(dVL*(Math.sqrt(dDTE/365)));
        			sD1=Double.toString(dD1);
        			myD1.setText(sD1);
        		}
        	}

    		
        	});
    }
}


package com.CSV.Buescher;

import org.apache.commons.math.MathException;
import org.apache.commons.math.distribution.NormalDistributionImpl;

public class SDCalculator {
	 public Double Calc (Double a){
		 NormalDistributionImpl myND = new NormalDistributionImpl(); 
	        try {
				a = (myND.cumulativeProbability(a));
			} catch (MathException e) {
				// TODO Auto-generated catch block
				//e.printStackTrace();
			}
		return a;
		
	 }
}


//Main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:weightSum="1">
    <LinearLayout android:id="@+id/linearLayout1" android:layout_height="50dp" android:weightSum="1" android:layout_width="531dp">
       <TextView android:textAppearance="?android:attr/textAppearanceSmall" 
       			android:layout_height="wrap_content" 
       			android:text="Stock Price" 
       			android:lines="2" 
       			android:layout_width="57dp" 
       			android:gravity="center" 
       			android:id="@+id/lblStockPrice">
       </TextView>
       <TextView android:textAppearance="?android:attr/textAppearanceSmall" 
       			android:layout_height="wrap_content" 
       			android:text="Exercise or Strike Price" 
       			android:lines="2" 
       			android:layout_width="70dp" 
       			android:gravity="center" 
       			android:id="@+id/lblExercise">
       </TextView>
       <TextView android:textAppearance="?android:attr/textAppearanceSmall" 
       			android:layout_height="wrap_content" 
       			android:text="Days to Expiration" 
       			android:lines="2" 
       			android:layout_width="70dp" 
       			android:gravity="center" 
       			android:id="@+id/lblDaysToExp">
       </TextView>
       <TextView android:textAppearance="?android:attr/textAppearanceSmall" 
       			android:layout_height="wrap_content" 
       			android:text="Treasury Return" 
       			android:lines="2" 
       			android:layout_width="70dp" 
       			android:gravity="center" 
       			android:id="@+id/lblTreasuryReturn">
       </TextView>
       <TextView android:textAppearance="?android:attr/textAppearanceSmall" 
       			android:layout_height="wrap_content" 
       			android:text="Volatility (Std Dev)" 
       			android:lines="2" 
       			android:layout_width="70dp" 
       			android:gravity="center" 
       			android:id="@+id/lblVolatility">
       </TextView>
       <TextView android:textAppearance="?android:attr/textAppearanceSmall" 
       			android:layout_height="wrap_content" 
       			android:text="d1" 
       			android:lines="2" 
       			android:layout_width="40dp" 
       			android:gravity="center" 
       			android:id="@+id/lbld1">
       </TextView>
       <TextView android:textAppearance="?android:attr/textAppearanceSmall" 
       			android:layout_height="wrap_content" 
       			android:text="d2" 
       			android:lines="2" 
       			android:layout_width="40dp" 
       			android:gravity="center" 
       			android:id="@+id/lbld2">
       </TextView>
       <TextView android:textAppearance="?android:attr/textAppearanceSmall" 
       			android:layout_height="wrap_content" 
       			android:text="Call Value" 
       			android:lines="2" 
       			android:gravity="center"
       			android:layout_width="57dp" 
       			android:id="@+id/lblCallValue">
       </TextView>
       <TextView android:textAppearance="?android:attr/textAppearanceSmall" 
       			android:layout_height="wrap_content" 
       			android:text="Put Value" 
       			android:lines="2" 
       			android:gravity="center"
       			android:layout_width="57dp" 
       			android:id="@+id/lblPutValue">
       </TextView>
    </LinearLayout>
    <LinearLayout android:id="@+id/linearLayout2" android:layout_height="50dp" android:layout_width="531dp">
        <EditText android:layout_width="57dp" android:layout_height="wrap_content" android:inputType="numberDecimal" android:id="@+id/txtStockPrice"></EditText>
        <EditText android:layout_width="70dp" android:layout_height="wrap_content" android:inputType="numberDecimal" android:id="@+id/txtExercise"></EditText>
        <EditText android:layout_width="70dp" android:layout_height="wrap_content" android:inputType="numberDecimal" android:id="@+id/txtDaysToExp"></EditText>
        <EditText android:layout_width="70dp" android:layout_height="wrap_content" android:inputType="numberDecimal" android:id="@+id/txtTreasuryReturn"></EditText>
        <EditText android:layout_width="70dp" android:layout_height="wrap_content" android:inputType="numberDecimal" android:id="@+id/txtVolatility"></EditText>
        <TextView android:text="0.000" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceSmall" android:layout_width="40dp" android:gravity="center" android:id="@+id/txtD1"></TextView>
        <TextView android:text="0.000" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceSmall" android:layout_width="40dp" android:gravity="center" android:id="@+id/txtD2"></TextView>
        <TextView android:text="0.000" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceSmall" android:layout_width="57dp" android:gravity="center" android:id="@+id/txtCallValue"></TextView>
        <TextView android:text="0.000" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceSmall" android:layout_width="57dp" android:gravity="center" android:id="@+id/txtPutValue"></TextView>
    </LinearLayout>
    <Button android:layout_width="wrap_content" android:id="@+id/btnCalculate" android:layout_height="wrap_content" android:text="Calculate"></Button>
</LinearLayout>


//strings.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="hello">Hello World, OptionsPricingCalculatorActivity!</string>
    <string name="app_name">OptionsPricingCalculator</string>
</resources>


//manifest

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.CSV.Buescher"
      android:versionCode="1"
      android:versionName="1.0">
    <uses-sdk android:minSdkVersion="8" />

    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".OptionsPricingCalculatorActivity"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>
</manifest>


debug errors are

<terminated>OptionsPricingCalculator [Android Application]	
	<disconnected>DalvikVM[localhost:8637]	
OptionsPricingCalculator [Android Application]	
	DalvikVM[localhost:8637]	
		Thread [<1> main] (Suspended (exception RuntimeException))	
			ActivityThread.performLaunchActivity(ActivityThread$ActivityRecord, Intent) line: 2663	
			ActivityThread.handleLaunchActivity(ActivityThread$ActivityRecord, Intent) line: 2679	
			ActivityThread.access$2300(ActivityThread, ActivityThread$ActivityRecord, Intent) line: 125	
			ActivityThread$H.handleMessage(Message) line: 2033	
			ActivityThread$H(Handler).dispatchMessage(Message) line: 99	
			Looper.loop() line: 123	
			ActivityThread.main(String[]) line: 4627	
			Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]	
			Method.invoke(Object, Object...) line: 521	
			ZygoteInit$MethodAndArgsCaller.run() line: 868	
			ZygoteInit.main(String[]) line: 626	
			NativeStart.main(String[]) line: not available [native method]	
		Thread [<6> Binder Thread #2] (Running)	
		Thread [<5> Binder Thread #1] (Running)
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 7 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros