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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:42:32+00:00 2026-06-02T23:42:32+00:00

I have a simple messaging application that gets the text of an editText box

  • 0

I have a simple messaging application that gets the text of an editText box and sends it to the server. All I want to do is when the text gets sent to the server, I want the editText box to reset.

Here is my code that works but, it doesn’t reset the editText box:

public void sendMessage(View v) {
        Editable messagetext;

        messagetext = message.getText();

        final SharedPreferences prefs = PreferenceManager
                .getDefaultSharedPreferences(getBaseContext());

        username = prefs.getString("username", "null");

        where = prefs.getString("chat", "null");
        message = (EditText) findViewById(R.id.inptbox);

        function = new Functions();

        response = function
                .sendMessage(username, where, messagetext.toString());

    }

If I add one more line of code, in order to reset the box my application dies:

public void sendMessage(View v) {
    Editable messagetext;

    messagetext = message.getText();
        message.setText("");
    final SharedPreferences prefs = PreferenceManager
            .getDefaultSharedPreferences(getBaseContext());

    username = prefs.getString("username", "null");

    where = prefs.getString("chat", "null");
    message = (EditText) findViewById(R.id.inptbox);

    function = new Functions();

    response = function
            .sendMessage(username, where, messagetext.toString());

}

The error I get (bear with me, I’m not that good logcat) is:

E/AndroidRuntime(7207): java.lang.IllegalStateException: Could not execute method of the activity

List of global variables:

String username = "";
    Functions function;
    EditText message;
    String response = "";
    String where = "";
    String inboxx;
  • 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-02T23:42:33+00:00Added an answer on June 2, 2026 at 11:42 pm
    ...
    messagetext = message.getText();                 
    ...
    message = (EditText) findViewById(R.id.inptbox);  
    ...
    

    Should not the order of these be reversed? You should need to say what ‘message’ is before you call getText on it.

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

Sidebar

Related Questions

I have simple WinForms application where modifying Windows Registry. The problem is that in
I have a pretty simple set up for a messaging application. I simply get
Basically I have a working application that sends an SMS after receiving an SMS.
I have a simple Android application that has a TabBar and one of the
I am creating a simple messaging system in WCF and have implemented a minimal
I have simple win service, that executes few tasks periodically. How should I pass
I have a simple messaging system, and I'd like to display both Received and
I have a simple messaging system in Rails with a Message table for the
I have a simple messaging queue setup and running using the Zend_Queue object heirarchy.
I have a sample single-page-application in Backbone that I am messing around with. The

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.