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

  • Home
  • SEARCH
  • 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 4546486
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T15:57:39+00:00 2026-05-21T15:57:39+00:00

Hey all thanks for looking this through. I really can’t understand why this happends,

  • 0

Hey all thanks for looking this through.
I really can’t understand why this happends, though it might have something to do with my background thread which is processing audioinput.
All works fine until i tilt the phone, havn’t yet put an landscape portrait or stuff like that in. So it should automatic just stretch my portrait layout.
But it does just stretch it, it also resets my label, and makes me unable to use my setText features on them. I also noticed that it pauses my background thread.
Here is code to set the textViews:

private void reactOnAudioMessage(Message msg) {
    TextView txtVwLastValue = (TextView) findViewById(R.id.txtVwLastValue);
    String result=null;
    DataFile newData=null;
    Bundle bndl=msg.getData();
    // ** newData getting created, with the correcy value etc this is not the problem.
    if(newData!=null){
        txtVwLastValue.setText("Last Value Received:" +newData.getValue());
        mDataList.add(newData);
        drawGraph(mImageView);
    } 
}

Here is my xml file

 <?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:id="@+id/layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Record"
android:id="@+id/btnRecord">
</Button>
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Last Value Received:" android:id="@+id/txtVwLastValue"></TextView>
<TextView android:text="TextView" android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/txtVwType"></TextView>
<ImageView android:src="@drawable/icon" android:layout_width="fill_parent" android:id="@+id/imgViewGraph" android:layout_height="300px"></ImageView>
</LinearLayout>
  • 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-21T15:57:40+00:00Added an answer on May 21, 2026 at 3:57 pm
    So it should automatic just stretch my portrait layout.
    

    This is not entirely true, as you have also seen. The expected behaviour for an unhandled orientation change is to recreate the Activity (which means going through the entire Activity lifecycle, onDestroy(), onCreate() and so forth – obviously the reason your label is being reset). This can be handled in various ways:

    http://developer.android.com/guide/topics/resources/runtime-changes.html &
    http://developer.android.com/resources/articles/faster-screen-orientation-change.html

    I “handle” orientation changes in 2 rather simple ways in my application. One activity is locked to portrait (as it makes no sense to view it in Landscape) by setting the screenOrientation flag in the Manifest:

    <activity android:name=".SettingsActivity" android:screenOrientation="portrait">
    

    The 2nd Activity that I use needs to be viewed in both ways as it contains a graph that looks best when viewed in Landscape. This basically means that I make sure that my Activity closes down gracefully (including any threads or handlers that I use) and is remade to draw the graph filling the screen in Landscape orientation.

    You need to think about how you wish to handle the orientation change. What makes the most sense in your application? There’s a lot of good resources around that talks about orientation changes through Google.

    I imagine the trouble you are having with the background thread is due to handlers that you have in the Activity which is destroyed and remade.

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

Sidebar

Related Questions

Hey all. I've been looking for a while for something that can help me
Hey all, I have something of an interesting requirement for my project. I need
Hey all, I'm looking for a fresh set of eyes to check out this
Hey all, my Computational Science course this semester is entirely in Java. I was
Hey all - I have an app where I'm authenticating the user. They pass
Hey all, I'm pulling my hair out on this one. I've checked all my
Hey all. I have a server written in java using the ServerSocket and Socket
hey all. I have a table in my DB that has about a thousand
Hey all, I'm currently working on a Java Swing application and I was looking
Hey all. I was fortunate enough to have Paolo help me with a piece

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.