skip to Main Content

Trying in AndroidStudio to change the text (id=version) depending on whether I get true or false from settings.isPremium().

How can I realize that?

settings.isPremium() works fine, I still want to know, how to toggle the text content.

if(settings.isPremium()) {

        view.findViewById(R.id.version).setText = "Premium"            

    }
else view.findViewById(R.id.version).setText = "NO Premium"   

2

Answers


  1. you can change the text of an view by settext(); hear you need to use it like this.
    view.findViewById(R.id.version).setText("Preminum")
    and use a Log.v() function to check if it is changed or not.
    Log.v(<Enter Function Name>,<Enter a string>);
    Hear you can use Log.v() like this.
    Log.V("Function name",String.valueof(settiings.ispreminum()));

    Login or Signup to reply.
  2. Try this:

     if(settings.isPremium()) 
    
         ((TextView) view.findViewById(R.id.version)).setText("Premium"); 
           
    else  
         ((TextView) view.findViewById(R.id.version)).setText("No Premium"); 
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search