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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:31:15+00:00 2026-05-24T06:31:15+00:00

I’m building an application that can send and received OSC. I’m using JavaOSC, it

  • 0

I’m building an application that can send and received OSC.
I’m using JavaOSC, it feets perfectly my needs.

I’m sending color value in OSC message, and receiving them also.

I send the color from a colorpicker based on this color picker
http://code.google.com/p/color-picker-view/
it works great.

My problem is :

  • When I choose the color in the color picker i’m setting the background of the layout (where the color picker is) view with :

private ColorPickerView.OnColorChangedListener colorListener = new ColorPickerView.OnColorChangedListener(){

    @Override
    public void onColorChanged(int color) {
        caller.sending("color", color);
        mScreen.setBackgroundColor(color);
    }
};

where mScreen is a LinearLyout

mScreen = (LinearLayout) findViewById(R.id.myScreen);

It works as expected.

  • When I’m receiving an OSC message with color I’d like to change the background too, but it crashes.

My listener is

OSCListener listener = new OSCListener() {

        public void acceptMessage(java.util.Date time, OSCMessage message) {
            //en cas de message vide
            if (message.getArguments().length == 0) return;
            //sinon on recupere les elements et on les tries
            Object[] args = message.getArguments();
            if (args[0].toString().contains("alpha")) Log.i("receiver osc", "Message received!");

            //Instructions
            if (args[0].toString().contains("color")) {
                int color = (Integer)args[1];                   
                //mColorPickerView.setColor((Integer)args[1]);
                mScreen.setBackgroundColor(color);
            }
            else return;
        }

You can find the crash report below.
Do the function setBackgroundColor need to be in a particular function to work properly (in a onClick function for example) or when it redraws something on the screen ?

Crash report

08-05 15:18:15.035: WARN/dalvikvm(18083): threadid=7: thread exiting with uncaught exception (group=0x4001d7d0)
ERROR/AndroidRuntime(18083): FATAL EXCEPTION: Thread-8
ERROR/AndroidRuntime(18083): android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
ERROR/AndroidRuntime(18083): at android.view.ViewRoot.checkThread(ViewRoot.java:2811)
ERROR/AndroidRuntime(18083): at android.view.ViewRoot.requestLayout(ViewRoot.java:594)
ERROR/AndroidRuntime(18083): at android.view.View.requestLayout(View.java:8180)
ERROR/AndroidRuntime(18083): at android.view.View.requestLayout(View.java:8180)
ERROR/AndroidRuntime(18083): at android.view.View.requestLayout(View.java:8180)
ERROR/AndroidRuntime(18083): at android.view.View.setBackgroundDrawable(View.java:7535)
ERROR/AndroidRuntime(18083): at android.view.View.setBackgroundColor(View.java:7429)
ERROR/AndroidRuntime(18083): at com.taprik.Remote.RemoteMain$4.acceptMessage(RemoteMain.java:202)
ERROR/AndroidRuntime(18083): at com.illposed.osc.utility.OSCPacketDispatcher.dispatchMessage(Unknown Source)
ERROR/AndroidRuntime(18083): at com.illposed.osc.utility.OSCPacketDispatcher.dispatchPacket(Unknown Source)
ERROR/AndroidRuntime(18083): at com.illposed.osc.utility.OSCPacketDispatcher.dispatchBundle(Unknown Source)
ERROR/AndroidRuntime(18083): at com.illposed.osc.utility.OSCPacketDispatcher.dispatchPacket(Unknown Source)
ERROR/AndroidRuntime(18083): at com.illposed.osc.OSCPortIn.run(Unknown Source)
ERROR/AndroidRuntime(18083): at java.lang.Thread.run(Thread.java:1096)
WARN/ActivityManager(6722): Force finishing activity com.taprik.Remote/.RemoteMain

  • 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-24T06:31:16+00:00Added an answer on May 24, 2026 at 6:31 am

    android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.

    You can only alter UI elements on the UI thread:
    Note: Anything performed on the UI thread will block other UI actions. Ergo, if you’re cycling through some long list on the UI thread, the user cannot interact with the UI while it’s happening.

    MyActivity.this.runOnUiThread(new Runnable() {
        public void run() {
            mScreen.setBackgroundColor(color);
        }
    });
    

    Or:

    private Handler mHandler;
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        /* ... */
    
        // Create the handler
        mHandler = new Handler();
    }
    
    private void changeBgColor(final int color) {
        mHandler.post(new Runnable() {
            public void run() {
                mScreen.setBackgroundColor(color);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
I have a French site that I want to parse, but am running into
I'm making a simple page using Google Maps API 3. My first. One marker
Seemingly simple, but I cannot find anything relevant on the web. What is the
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

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.