ghasem deh

ghasem deh

  • NA
  • 258
  • 40.3k

how to change buttons background from another activity ?

Nov 16 2017 10:41 AM
hi, i have 3 XML layout file (in res) with several buttons . i use xml layouts in view pager into main activity in my app ... now i want change buttons background when my condition is true , how do it ?
 
 
 this my button in XML layout :
  1. <ir.rahgoshafan.alphabetpuzzle.customs.PuzzleButton  
  2.                 android:id="@+id/btn_green455"  
  3.                 android:layout_width="0dp"  
  4.                 android:layout_height="wrap_content"  
  5.                 android:layout_weight="0.33"  
  6.                 android:onClick="BTN_CLICK"  
  7.                 android:background="@drawable/button_red"  
  8.                 android:contentDescription="@string/app_name"  
  9.                 android:text="?????? ?????"  
  10.                 android:textColor="#fff"  
  11.                 android:textSize="20sp"  
  12.                 android:textStyle="bold" />  
and view pager in main activity :
  1. private void init() {  
  2.         ViewPager VIEW_PAGER = (ViewPager) findViewById(R.id.tour_view_pager);  
  3.         DOTS_LAYOUT = (LinearLayout) findViewById(R.id.tour_layout_dots);  
  4.         LAYOUTS = new int[]{R.layout.items_one, R.layout.items_two, R.layout.items_three};  
  5.         addBottomDots(0);  
  6.         TourViewPagerAdapter ViewPagerAdapter = new TourViewPagerAdapter();  
  7.         VIEW_PAGER.setAdapter(ViewPagerAdapter);  
  8.         VIEW_PAGER.addOnPageChangeListener(viewPagerPageChangeListener);  
  9.     }  
 

Answers (1)