onActivityResult not updating ui


  1. UziTech

    UziTech New Member

    In my program I have a preference activity that is set to return a result. I dont actually care what the result is i just want to know when it returns.

    The code below is the OnActivityResult function. The activity calls the function correctly except when the array of TextViews (F) is set to Invisible they don't disappear. getInvisibility() returns invisible if called right after it is set but if called later it doesn't. If setVisibility(View.INVISIBLE) is called any other time on F in my program it works perfectly.

    The code below the for loops is another array of TextViews (L) and that setText works just like it is supposed to.

    Is there something wrong with my code or is there another issue with setVisibility() in onActivityResult()?

    Code (Text):
    1.  
    2. @Override
    3. public void onActivityResult(int requestCode, int resultCode, Intent data){
    4.         for(int i = 0; i < MAXPLAYERS; i++){
    5.             for(int j = 0; j < 3; j++){
    6.                 F[i][j].setVisibility(View.INVISIBLE);
    7. //This does not make the texviews invisible even though F[i][j].getVisibility() will return View.INVISIBLE
    8.             }
    9.         }
    10.  
    11.         L[0].setText(settings.getString("Player1", getString(R.string.Player1)));//This works perfectly
    12. }
    13.  
    when I changed the code to this it worked

    Code (Text):
    1.  
    2. @Override
    3. public void onActivityResult(int requestCode, int resultCode, Intent data){
    4.         for(int i = 0; i < MAXPLAYERS; i++){
    5.             for(int j = 0; j < 3; j++){
    6.                 F[i][j].setText("");//This works perfectly but not what I want to do
    7.             }
    8.         }
    9.  
    10.         L[0].setText(settings.getString("Player1", getString(R.string.Player1)));//This works perfectly
    11. }
    12.  
    but I dont want to change the text I want to make it invisible.

    Why does the setText()function work but the setVisibility() function not work?

    Advertisement
    :
Loading...

Share This Page