Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 6th, 2012  |  syntax: None  |  size: 0.73 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Check if a view belongs to a linearlayout or not
  2. LinearLayout layoutWithButton = (LinearLayout)findViewById(R.id.layout_with_button);
  3. ImageButton buttonInLayout = (ImageButton)layoutWithButton.findViewById(R.id.button_in_layout);
  4.  
  5. if (buttonInLayout != null) {
  6.   // Found
  7. }
  8.        
  9. View parent = (View)mContent.getParent();
  10. if (parent instanceof LinearLayout) {
  11.     // do stuff
  12. }
  13.        
  14. LinearLayout contentLayoutAddressPostal = (LinearLayout)findViewById(R.id.se_contentAdressPostal);
  15.  
  16.      ImageButton imbtRemoveAddress2 = (ImageButton)findViewById(R.id.sfsp2_ivHide);
  17.  
  18.        if(imbtRemoveAddress2.getParent()==contentLayoutAddressPostal){
  19.           imbtRemoveAddress2.performClick();
  20.                                     ............................