Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Get all controls names on a layout

  1. #1
    Junior Member
    Join Date
    Oct 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Get all controls names on a layout

    Hi, I'm new on Java/android and I wounder how could I get name of each control in a layout, ex.
    for (int i=0;i<table1.getChildCount();i++ )
    {
    Object child=table1.getChildAt(i);
    if( child instanceof EditText)
    {
    //get control name here
    }
    }

    if anyone can help me thanks


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,660
    Thanks
    53
    Thanked 2,420 Times in 2,373 Posts

    Default Re: Get all controls names on a layout

    how could I get name of each control
    Can you give an example of what you mean by the name of a control?

    What did you get when you executed the posted code? Print out the value of child for some info from the object.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. GUI Layout - Does anyone know how to set a layout?
    By mikemontesa in forum What's Wrong With My Code?
    Replies: 1
    Last Post: November 20th, 2013, 04:35 PM
  2. Replies: 1
    Last Post: June 25th, 2013, 08:49 AM
  3. Problem with Controls because of buttons
    By SagiIs in forum What's Wrong With My Code?
    Replies: 6
    Last Post: December 29th, 2011, 12:11 AM
  4. Replies: 2
    Last Post: July 8th, 2011, 06:33 AM
  5. Replies: 1
    Last Post: April 14th, 2011, 07:50 AM

Tags for this Thread