Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7008539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:44:55+00:00 2026-05-27T21:44:55+00:00

It has no errors, but when I run it, it crashes. The portion of

  • 0

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:

    int h = (a * c);
    List<Integer> factors = new ArrayList<Integer>();
    for (int i = 1; i < 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);
    }

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

package boston.project;

public class Euclid {
    public static int getGcd(int a, int b) {
        while (b != 0) {
            if (a > b) {
                a -= b;
            } else {
                b -= a;
            }
        }
        return a;
    }
}

EDIT

LogCat

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:44:55+00:00Added an answer on May 27, 2026 at 9:44 pm

    I think the error occurs because you are using a TextView in your layout but try to cast it to a EditText in your code.
    You should change

    EditText tvfact1a = (EditText) findViewById(R.id.tvfact1);
    EditText tvfact2a = (EditText) findViewById(R.id.tvfact2);
    

    to

    TextView tvfact1a = (TextView) findViewById(R.id.tvfact1);
    TextView tvfact2a = (TextView) findViewById(R.id.tvfact2);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A colleague has passed me an interesting code sample that crashes with an InvalidProgramException
Everyone (at least everyone who uses a compiled language) has faced compilation errors but
I have a skelta workflow that has finished with errors according to the WorkflowExecutionReport.
I'm seeing strange errors when my C++ code has min() or max() calls. I'm
i know that this question has been posted a lot of times but the
I've got a code with an ASyncTask and the problem is that when I
I have an application that has been getting strange errors when canceling out of
I want to create one proc like below but it has error on syntax.
has anyone gotten these ms-access errors? what do they mean? im connecting access with
My website has been giving me intermittent errors when trying to perform any Ajax

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.