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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:40:54+00:00 2026-06-17T16:40:54+00:00

I am getting a wrong thread error, so I am thinking I need to

  • 0

I am getting a wrong thread error, so I am thinking I need to be running invalidate from the UI thread. Usually I have something like:

public void run() {

                runOnUiThread(new Runnable() {
}});

But I need to name this runnable to reference it from a method. How do i incorporate runOnUiThread into this?

Handler viewHandler = new Handler();
Runnable updateView = new Runnable() {
@Override

public void run() {

    mEmulatorView.invalidate();

    if (statusBool == true) {
        for (int i = 1; i < dataReceived.length() - 1; i++) {

            if (dataReceived.charAt(i) == '>') {

                Log.d(TAG, "found >");
                deviceStatus = 0;
            }
            if (dataReceived.charAt(i) == '#'
                    && dataReceived.charAt(i - 1) != ')') {

                Log.d(TAG, "found #");
                deviceStatus = 1;
            }
            if ((i + 1) <= (dataReceived.length())
                    && dataReceived.charAt(i) == ')'
                    && dataReceived.charAt(i + 1) == '#') {

                Log.d(TAG, "found config )#");
                deviceStatus = 2;
            }

        }
        statusBool = false;
        viewHandler.postDelayed(updateView, 1000);

    }
}
};

calling it:

public void onDataReceived(int id, byte[] data) {

        dataReceived = new String(data);
        ((MyBAIsWrapper) bis).renew(data);
        mSession.write(dataReceived);
        viewHandler.post(updateView);
}
  • 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-17T16:40:54+00:00Added an answer on June 17, 2026 at 4:40 pm

    You don’t need to name it. If you want to post itself you can just use this keyword:

    viewHandler.postDelayed(this, 1000);
    

    UPDATE

    Wrong thread error caused by mSession.write(dataReceived);. updateView doesn’t cause any problems. Try to wrap mSession.write to runnable and call it on ui thread.

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

Sidebar

Related Questions

I'm getting error reports from users and I have no idea whats wrong with
(Maybe I am doing something wrong but) I am getting awful read performance from
I'm getting the following error message : Exception in thread main java.lang.NoClassDefFoundError: LU62XnsCvr (wrong
I have a jboss web service that is getting the wrong initial context. I
I keep getting this stored procedure error (wrong number or types of the arguments)
Am getting this error message and matched my brackets and couldn't find anything wrong.
I'm getting this error pointing to some .so file when running my application on
I am getting an error which I have no idea how to fix. I
I am getting this error while executing my android app. I have created the
Possible Duplicate: pthread Function from a Class I am getting an error (Can not

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.