What is wrong with my code? (crashes right when code is executed)
<p>It has no errors, but when I run it, it crashes. The portion of my code that I believe the problem is in is as follows:</p>

<pre><code>    int h = (a * c);
    List&lt;Integer&gt; factors = new ArrayList&lt;Integer&gt;();
    for (int i = 1; i &lt; Math.sqrt(h); i++) {
        if (h % i == 0)
            factors.add(i);
    }
    Integer result = null;
    for (int ii : factors) {
        if (b == ii + h / ii) {
            result = ii;
            // ax^2+hiix+iix+c
        }
        int hii = h / ii;
        int gcd1 = Euclid.getGcd(a, hii);
        int gcd2 = Euclid.getGcd(ii, c);
        String factored1 = ("(" + gcd1 + "x+" + gcd2 + ")");
        int fact21 = (a / gcd1);
        int fact22 = (hii / gcd1);
        String factored2 = ("(" + fact21 + "x+" + fact22 + ")");
        EditText tvfact1a = (EditText) findViewById(R.id.tvfact1);
        EditText tvfact2a = (EditText) findViewById(R.id.tvfact2);
        tvfact1a.setText(factored1);
        tvfact2a.setText(factored2);
    }
</code></pre>

<p>a and c are initialized earlier in the program. The Euclid class is as follows:</p>

<pre><code>package boston.project;

public class Euclid {
    public static int getGcd(int a, int b) {
        while (b != 0) {
            if (a &gt; b) {
                a -= b;
            } else {
                b -= a;
            }
        }
        return a;
    }
}
</code></pre>

<p>EDIT</p>

<p>LogCat</p>

<p>01-01 15:28:59.479: W/KeyCharacterMap(303): No keyboard for id 0<br>
01-01 15:28:59.479: W/KeyCharacterMap(303): Using default keymap: /system/usr/keychars/qwerty.kcm.bin<br>
01-01 16:22:03.158: W/KeyCharacterMap(334): No keyboard for id 0<br>
01-01 16:22:03.158: W/KeyCharacterMap(334): Using default keymap: /system/usr/keychars/qwerty.kcm.bin<br>
01-01 16:22:16.739: D/AndroidRuntime(334): Shutting down VM<br>
01-01 16:22:16.739: W/dalvikvm(334): threadid=1: thread exiting with uncaught exception (group=0x4001d800)<br>
01-01 16:22:16.759: E/AndroidRuntime(334): FATAL EXCEPTION: main<br>
01-01 16:22:16.759: E/AndroidRuntime(334): java.lang.ClassCastException: android.widget.TextView<br>
01-01 16:22:16.759: E/AndroidRuntime(334):  at boston.project.TheBostonProjectActivity$1.onClick(TheBostonProjectActivity.java:138)<br>
01-01 16:22:16.759: E/AndroidRuntime(334):  at android.view.View.performClick(View.java:2408)<br>
01-01 16:22:16.759: E/AndroidRuntime(334):  at android.view.View$PerformClick.run(View.java:8816)<br>
01-01 16:22:16.759: E/AndroidRuntime(334):  at android.os.Handler.handleCallback(Handler.java:587)<br>
01-01 16:22:16.759: E/AndroidRuntime(334):  at android.os.Handler.dispatchMessage(Handler.java:92)<br>
01-01 16:22:16.759: E/AndroidRuntime(334):  at android.os.Looper.loop(Looper.java:123)<br>
01-01 16:22:16.759: E/AndroidRuntime(334):  at android.app.ActivityThread.main(ActivityThread.java:4627)<br>
01-01 16:22:16.759: E/AndroidRuntime(334):  at java.lang.reflect.Method.invokeNative(Native Method)<br>
01-01 16:22:16.759: E/AndroidRuntime(334):  at java.lang.reflect.Method.invoke(Method.java:521)<br>
01-01 16:22:16.759: E/AndroidRuntime(334):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)<br>
01-01 16:22:16.759: E/AndroidRuntime(334):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)<br>
01-01 16:22:16.759: E/AndroidRuntime(334):  at dalvik.system.NativeStart.main(Native Method)  </p>
