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 8182957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:00:58+00:00 2026-06-07T01:00:58+00:00

I am getting this error on android emulator. I’m using this to get int

  • 0

I am getting this error on android emulator.
I’m using this to get int values from user:It works fine with String values but not with int values. tried parseInt() also but no luck.

   public void btnAddTest(View view)
    {
   dbHelper= new DatabaseHelper(this);    
     boolean ok=true;
    try
    {           String tname=test.getText().toString();
    String Unit=unit.getText().toString();
        Spannable spn=a.getText();
        Spannable spn1=f.getText();
        Spannable spn2=t.getText();
        Spannable _aft=aft.getText();
        Spannable x2=calx2.getText();
        Spannable _x=calx.getText();
        Spannable val=num.getText();


        int avalue=Integer.parseInt(spn.toString());
        int fvalue=Integer.parseInt(spn1.toString());
        int tvalue=Integer.parseInt(spn2.toString());
        int AFTID=Integer.parseInt(_aft.toString());
        int num1=Integer.parseInt(x2.toString());

        int num2=Integer.parseInt(_x.toString());

        int num3=Integer.parseInt(val.toString());
//      process p=new process(AFTID,avalue,fvalue,tvalue);

        testname t= new testname(tname,Unit,num1,num2,num3,AFTID);
        setTitle("Processing");
        dbHelper.testname(t);
    //  dbHelper.process(p);

    }
    catch(Exception ex)
    {
        ok=false;
        CatchError(ex.toString());
    }
    finally
    {
        if(ok)
        {

// NotifyEmpAdded();
class1.ShowAlert2(this);

        }
    }}
void CatchError(String Exception)
{
    Dialog diag=new Dialog(this);
    diag.setTitle("Add new Test");
    TextView txt=new TextView(this);
    txt.setText(Exception);
    diag.setContentView(txt);
    diag.show();
}Spannable spn=a.getText();
  int avalue=Integer.valueOf(spn.toString());

This is the logcat:

   07-06 14:37:43.063: E/AndroidRuntime(864): FATAL EXCEPTION: main
   07-06 14:37:43.063: E/AndroidRuntime(864): java.lang.RuntimeException: Unable to instantiate application android.app.Application: java.lang.NullPointerException
   07-06 14:37:43.063: E/AndroidRuntime(864):   at android.app.LoadedApk.makeApplication(LoadedApk.java:482)
   07-06 14:37:43.063: E/AndroidRuntime(864):   at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3938)
   07-06 14:37:43.063: E/AndroidRuntime(864):   at android.app.ActivityThread.access$1300(ActivityThread.java:123 )
   07-06 14:37:43.063: E/AndroidRuntime(864):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1185)
   07-06 14:37:43.063: E/AndroidRuntime(864):   at android.os.Handler.dispatchMessage(Handler.java:99)
   07-06 14:37:43.063: E/AndroidRuntime(864):   at android.os.Looper.loop(Looper.java:137)
   07-06 14:37:43.063: E/AndroidRuntime(864):   at android.app.ActivityThread.main(ActivityThread.java:4424)
   07-06 14:37:43.063: E/AndroidRuntime(864):   at java.lang.reflect.Method.invokeNative(Native Method)
   07-06 14:37:43.063: E/AndroidRuntime(864):   at java.lang.reflect.Method.invoke(Method.java:511)
   07-06 14:37:43.063: E/AndroidRuntime(864):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
   07-06 14:37:43.063: E/AndroidRuntime(864):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
   07-06 14:37:43.063: E/AndroidRuntime(864):   at dalvik.system.NativeStart.main(Native Method)
   07-06 14:37:43.063: E/AndroidRuntime(864): Caused by: java.lang.NullPointerException
   07-06 14:37:43.063: E/AndroidRuntime(864):   at android.app.LoadedApk.initializeJavaContextClassLoader(LoadedApk.java:362)
   07-06 14:37:43.063: E/AndroidRuntime(864):   at android.app.LoadedApk.getClassLoader(LoadedApk.java:305)
   07-06 14:37:43.063: E/AndroidRuntime(864):   at android.app.LoadedApk.makeApplication(LoadedApk.java:474)
   07-06 14:37:43.063: E/AndroidRuntime(864):   ... 11 more
   07-06 14:38:05.103: I/dalvikvm(897): threadid=3: reacting to signal 3
   07-06 14:38:05.343: I/dalvikvm(897): Wrote stack traces to '/data/anr/traces.txt'
   07-06 14:38:05.681: I/dalvikvm(897): threadid=3: reacting to signal 3
   07-06 14:38:05.802: I/dalvikvm(897): Wrote stack traces to '/data/anr/traces.txt'
   07-06 14:38:05.934: D/dalvikvm(897): GC_FOR_ALLOC freed 60K, 4% free 6524K/6787K, paused 66ms

This is the xml file layout:

     <TableRow
            android:id="@+id/tableRow2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="#ffffffff"
            android:ems="10"
            android:gravity="center_horizontal"
            android:inputType="number"
            android:textColor="#ff000000" >

            <EditText
                android:id="@+id/id1"
                android:inputType="number" />

            <EditText
                android:id="@+id/a1"
                android:inputType="number" />

            <EditText
                android:id="@+id/f1"
                android:inputType="number" />

            <EditText
                android:id="@+id/t1"
                android:inputType="number" />

        </TableRow>
  • 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-06-07T01:00:59+00:00Added an answer on June 7, 2026 at 1:00 am
      if ( a!=null ) {
          Spannable spn=a.getText();
          int avalue=Integer.valueOf(spn.toString());
      }
    

    Good luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Eclipse and created HelloWorld and it works fine using emulator. Then
i seem to be getting this error everytime i try to run my android
In my Android application for reading RSS links, I am getting this error: java.net.UnknownHostException:
Getting the javax.net.ssl.SSLPeerUnverifiedException: No peer certificate error in an emulator running Android 2.3 but
Why I am I getting this error on a standard Android Level 10 API
when i am publishing my application to android market i am getting this error:Market
i'm new to android, i'm getting this error. please help me in providing the
When trying to start up my Android AVD emulator, I get the following error
Getting this error: java.lang.RuntimeException: An error occured while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:200) at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:274)
Getting this error: 2009-09-03 12:44:02.307 xcodebuild[307:10b] warning: compiler 'com.apple.compilers.llvm.clang.1_0.analyzer' is based on missing compiler

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.