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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:30:36+00:00 2026-05-26T16:30:36+00:00

In my app, I’ve got 3 tabs. On clicking on each individual tab, some

  • 0

In my app, I’ve got 3 tabs. On clicking on each individual tab, some tab specific task happens. Now I am supposed to test the scenario of changing tabs from an android test project. In order to do that, I’ve called getTabHost.setCurrentTab(int tabIndex) method. But an error has been thrown saying

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

  • 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-26T16:30:36+00:00Added an answer on May 26, 2026 at 4:30 pm

    The exception is quite self explanatory: “Only the original thread that created a view hierarchy can touch its views.” In other words, you’re trying to change the current tab from a different thread than the one that created it. More specifically, you have to do this action on the widget from the GUI thread – the thread that created the view hierarchy.

    So you either have to move your setCurrentTab(int tabIndex) call to the GUI thread, or use a message mechanism. The latter is usually done using a Handler. Plenty of good examples and code snippets ‘out there’ that can show you how to go about this.

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

Sidebar

Related Questions

App Store We have been developing an app for quite some time now for
My app is working on many devices without problems so far. But now I
My app uses the android.support.v4.view.ViewPager class. For each page in the ViewPager, I want
app.yaml application: cloudymovie version: 1 runtime: java welcome_files: - test.jsp handlers: - url: /test/*
Our app (before authentication) has Customers and Widgets. As you'd expect each customer has
My app downloads a number of jpegs every now and again. All the jpeg
App Engine only allows you to use these formats for XMPP addresses: app-id@appspot.com anything@app-id.appspotchat.com
app.get('/', function (req, res) { res.render('home.jade', { results: req.session.value }); }); What i would
My app is working fine on 2.2 and 2.3 emulators. But when I tried
My App needs to connect to and grab data from a MySQL database sitting

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.