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 6 of 6

Thread: Screen item not appearing when routine called

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

    Default Screen item not appearing when routine called

    Hi I am a newcomer to this forum and am using java in Eclipse for Android programming. I have a method :-
    private void turnOnRedLight(){

    // Code to turn light on.....
    }
    When I call this from inside another 2nd method the light does not immediately become visble and only appears when the 2nd method exits. Is there any way to make the object visible immediately ??


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Screen item not appearing when routine called

    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for new members.

    Thread moved.

  3. #3
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,162
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Screen item not appearing when routine called

    appears when the 2nd method exits
    That sounds like a threading problem. The method is using the thread the jvm uses for updating the GUI so it can't do the update until the method exits.
    If you don't understand my answer, don't ignore it, ask a question.

  4. #4
    Junior Member
    Join Date
    May 2014
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Screen item not appearing when routine called

    Hi norm - Many thanks for reply. I am fairly new to all this so I am afraid threading doe not mean much to me just yet. Does what you say mean that the problem is ocurring only whist running on a Virtual Machine.? If so would the APP run OK when it is installed on a real Android Tablet?

  5. #5
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,162
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Screen item not appearing when routine called

    By jvm I meant the Android OS that executes the app.
    If you don't understand my answer, don't ignore it, ask a question.

  6. #6
    Junior Member
    Join Date
    May 2014
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Screen item not appearing when routine called

    I am sorry Norm but that doe not mean much to me. It does not suggest anything that might help me to solve the problem. I think that I will have to try installing the App on my Android Tablet and see if it does the same thing there.

Similar Threads

  1. [SOLVED] Adjust screen size and button arrangement for any computer screen
    By Prathiksha in forum AWT / Java Swing
    Replies: 4
    Last Post: April 23rd, 2014, 11:11 AM
  2. display item for item selected in combobox
    By cisco.nat in forum AWT / Java Swing
    Replies: 1
    Last Post: June 20th, 2013, 07:12 AM
  3. Replies: 9
    Last Post: December 31st, 2011, 01:22 AM
  4. I Cant seem to get my sort routine to function
    By rrickman9 in forum What's Wrong With My Code?
    Replies: 15
    Last Post: May 22nd, 2011, 07:48 PM
  5. drag item or insert item into new Jlabel in JPanel
    By qaromi in forum AWT / Java Swing
    Replies: 5
    Last Post: July 6th, 2010, 07:37 PM