Android Silent Mode Toggle

后端 未结 2 740
慢半拍i
慢半拍i 2021-02-04 22:45

I started reading Android for dummies and I am trying to make my first app that is Silent Mode Toggle.

Now the problem I\'m facing is:

In the layout, I need som

2条回答
  •  囚心锁ツ
    2021-02-04 23:15

    It sounds like you want a textview that says whether silent mode is/isnt activated? ie just a small bit of text near a button, that shows status? And your buttons to dynamically appear/dissapear as well?

    TextView tv = (TextView)findviewbyid(R.id.relevanttextview); //text above button/wherever
    Button bt = (Button)findviewbyid(R.id.relevantbutton); //button to make appear/dissapear 
    
    if(vibrate is on){
    tv.setText("vibrate is on");
    bt.setVisibility(View.VISIBLE); //make button appear
    }
    
    if(normal mode is on){
    tv.setText("normal");
    bt.setVisibility(View.INVISIBLE); //make button dissapear
    }
    

    etc...

提交回复
热议问题