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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:58:27+00:00 2026-06-04T19:58:27+00:00

I have written this simple app to make a call based on handler delay

  • 0

I have written this simple app to make a call based on handler delay by ms. However for some reason it crashes the app when I action the public void callme(View view) via button onClick event.

I am sure it is something simple, perhaps someone could point out my errors. Thanks

  import android.app.Activity;
    import android.content.Intent;
    import android.net.Uri;
    import android.os.Bundle;
    import android.os.Handler;
    import android.view.View;
    import android.widget.EditText;

    public class CallButtonActivity extends Activity {


        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);

          }


     public void callme(View view) {

       EditText edit_seconds = (EditText)findViewById(R.id.seconds);
       CharSequence edit_seconds_value = edit_seconds.getText();

        int mSeconds = Integer.parseInt(edit_seconds_value.toString());   

         Handler myHandler = new Handler();
         myHandler.postDelayed(mMyRunnable, mSeconds);


     }

     private Runnable mMyRunnable = new Runnable()
     {
         public void run()
         {

             EditText msisdn = (EditText)findViewById(R.id.msisdn);

             Intent callIntent = new Intent(Intent.ACTION_CALL);
             callIntent.setData(Uri.parse("tel:" + msisdn));
             startActivity(callIntent);
         }
      };


    }
  • 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-04T19:58:28+00:00Added an answer on June 4, 2026 at 7:58 pm

    In this line…

    int mSeconds = Integer.parseInt(time.toString());
    

    It should be time.getText().toString(). You also need to use getText().toString() for the telephone number – NOT just getText() as that (on an EditText) returns an Editable and not a String.

    I’m not sure, however, if using findViewById(...) with a Runnable is legal although I may be wrong.

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

Sidebar

Related Questions

I have written this code in javascript however I have to make it work
I am a beginner in Python and I have written this simple code but
This is a simple script I have written to test command line argument handling:
I have written this program, which sorts some ints using a functor: #include<iostream> #include<list>
I have written this short script (which I've stripped away some minor detail for
I have written a simple helloworld app with a WebView which has a link
I have a simple console application written in .NET. I need to make an
I am learning iOS and I have written a simple iPhone app using iOS
I have an almost complete simple web app written as a Python CGI script.
I have written a relatively simple Java App Engine application which I would like

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.