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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:35:31+00:00 2026-06-11T10:35:31+00:00

There are two different xml files in layout and layout-land for the respective modes.

  • 0

There are two different xml files in layout and layout-land for the respective modes. As I want to set the values back in the edittexts even when orientation changed, I am using android:configChanges="orientation|keyboardHidden" in manifest file. This deactivates the execution of onCreate() method again and the present activity is not destroyed.

I have two frames in my app. First frame contains 25 edittexts and second contains 10 buttons. So in portrait mode, these frames are one after the other and in landscape mode one next to the other. To get this view according to modes, I wrote setContentView(R.layout.main); in the onConfigurationChanged() method. But my problem here is I am able to store the values that entered already in the editTexts in onConfigurationChanged(). But I am unable to set the values back to the edittexts after setting to the respective layout. Because I am getting respective layout, but with empty edittexts. The following code snippet gives overview of my problem.

public void onCreate()
{
setContentView(R.layout.main);
gridView = (GridView) findViewById(R.id.gridView1);
gridView.setAdapter(new EditTextAdapter(this)); //This creates 25 edittexts in the gridview which is in first frame.

} 

public void getEditTexts()//getting the edittext objects here in the activity class
{
editText1=gridView.getChildAt(k);
...........
...........
}

public void onConfigurationChanged()
{
String s1=editText1.getText().toString();//Here I am using technique to store the values.

setContentView(R.layout.main);
gridView.setAdapter(new EditTextAdapter(this));
getEditTexts();
editText1.setText(s1);    //here is my problem. I am unable to set values back in the editText.

}

Where I am going wrong? How to set the values back like this in 25 edittexts in the present mode if they are set in previous mode. Please suggest. Here I guess the values are set in the old edittext objects itself even though the mode is changed. How to set the values in the new edittext objects? How come the values are set in old edittext objects if they are not present in the current layout? Or there is another reason for this problem?

  • 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-11T10:35:32+00:00Added an answer on June 11, 2026 at 10:35 am

    I have created an alternative application for your requirement. I have not used grid view still I can add as many views as I want without XML’s. The code checks the device configuration and the view size and add that many rows and columns to the layout. This is a basic example you can modify it for your requirement.
    Here is a link to the code

    Feel free to discuss in case there is any doubt.

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

Sidebar

Related Questions

I have two xml files which have the same data but different names for
In My application XML layout, I have one Relativelayout, In which there are two
I have two XML files with two different XSD schemas and different namespaces. They
A similar question was posted as question:is-there-a-way-to-use-multiple-wsit-client-xml.. . I have two different WS-Security enabled
I found there're two different opinions about how greedy regex is executed: one is,
Lets say there are two pages with two different html elements which have the
In struts I notice there are two different ways to access variables. I am
As I see it there are two different types of logging: User-focused logs, like
In Zend Framework in Response Class there are two different arrays for storing headers:
Is there anyway to batch two different select queries to either SQLite or SQLCE

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.