0

I'm working on a voip/sip based application which is capable of making calls from a dialpad widget which has the four buttons at the bottom

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal" >

<ImageButton
    android:id="@+id/ibtn_handsfree"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:background="@drawable/selector_dialpad_action_button"
    android:src="@drawable/selector_handsfree" />

<ImageButton
    android:id="@+id/ibtn_headset"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:background="@drawable/selector_dialpad_action_button"
    android:src="@drawable/selector_headset" />

<ImageButton
    android:id="@+id/ibtn_copyToDir"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:background="@drawable/selector_dialpad_action_button"
    android:src="@drawable/selector_copytodir" />

<ImageButton
    android:id="@+id/ibtn_keyboard"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:background="@drawable/selector_dialpad_action_button"
    android:src="@drawable/selector_keyboard" />
<ImageButton 
    android:id="@+id/ibtn_sendkey_widget"
     android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:background="@drawable/selector_dialpad_action_button"
    android:src="@drawable/selector_send_key_dialer"
    />
</LinearLayout>
  1. Is it discouraged that I toggle the visibility of any of my layout elements dynamically ? For example if I wish to hide the fourth button, depending on any active call present(which I believe would require an individual and dedicated listener attached).
  2. If the dynamic changes on the widget layout aren't discouraged, how do I go about doing that ?

Appreciate your thoughts and help.

Renjith
  • 5,783
  • 9
  • 31
  • 42
Aalok Sharma
  • 1,025
  • 2
  • 12
  • 26

1 Answers1

1

I don't know the answer for the first question, but in order to toggle visibility of a button in a widget:

ozbek
  • 20,955
  • 5
  • 61
  • 84
  • Hey, yea I know that much, but I need to toggle the visibility whenever there is a change in the call state of the application, which could be quite frequent. – Aalok Sharma May 09 '13 at 07:25
  • Even if so, the above holds. All you need to do is listen to call state change and update the visibility accordingly. – ozbek May 09 '13 at 07:49
  • And I believe,for listening to that event I will need a dedicated service specially for that.. – Aalok Sharma May 09 '13 at 07:58
  • Yeah, maybe. But your question was not about how to listen to phone state changes, was not it? – ozbek May 09 '13 at 08:02