java - how can I get View from another view -


here xml file

             <framelayout                   android:layout_alignparentright="true"                  android:layout_alignparentbottom="true"                  android:layout_width="wrap_content"                  android:layout_height="wrap_content"                  >                  <button                     android:id="@+id/button1"                     style="?android:attr/buttonstylesmall"                     android:layout_width="50dp"                     android:layout_height="30dp"                     android:text="@string/productbutton_download"                     android:onclick="testgetview"                      />                   <progressbar                      style="?android:attr/progressbarstylehorizontal"                      android:layout_width="50dp"                      android:layout_height="30dp"                      android:visibility="invisible"                       />              </framelayout> 

i want progressbar instance use function testgetview instead of use resource id

public void testgetview(view button) {     // can use view progressbar below  } 

you have set id progressbar, button, parent view getparent(), cast viewgroup , call findviewbyid(int id) id of progressbar


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -