• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Display issue in Layout

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to display random numbers in a 3 rows and 3 column  table with 8 numbers and one empty cell.
When i review in Android studio its showing correctly but when i run the application on my mobile i am getting 4 X 4 table.
Please find the attached both the screenshots.

In the same app I have another layout page with 4 rows and 4 columns table but its working as per my expectation.

I have reviewd the code several times but i could not be able to find the root cause. Please help me to find out why in mobile 4 rows and 4 columns were displayed instead of 3 rows and 3 columns.

Activity1.PNG
[Thumbnail for Activity1.PNG]
Activity2.PNG
[Thumbnail for Activity2.PNG]
 
Rancher
Posts: 5008
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

why in mobile 4 rows and 4 columns were displayed instead of 3 rows and 3 columns.


Where is the code that decides which layout to use and loads it?

What is the filename of the xml that you posted?
 
mohana krishna
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi  Norm Radder ,

Thanks for your response.

Question ) : What is the filename of the xml that you posted?
Answer ) activity_number_page_three.xml .
Question)  Where is the code that decides which layout to use and loads it?
Answer) Following xml code and java code.

This file name is activity_main.xml.



When user click on "@string/ThreeByThree" button following java code will be called.


In NumberPageThree.java i have logic to populate values for all the fields and other logic.
 
Norm Radder
Rancher
Posts: 5008
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where is the code that uses: activity_number_page_three.xml ?

Starting with the code in the MainActivity, what is the sequence of events that should cause activity_number_page_three.xml  layout to be loaded?
 
mohana krishna
Ranch Hand
Posts: 76
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi  Norm Radder ,
Thanks for your help, now i got the issue.
After changing the following line with correct layout file name its working fine.



Earlier i referred the wrong layout file here.
Thanks once again for your help.
 
Norm Radder
Rancher
Posts: 5008
38
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are welcome.  I am glad you found it.
 
You have to be odd to be #1 - Seuss. An odd little ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic