--------------------------------------------
On Wed, 1/25/17, ryan.pena via Android Developers 
<[email protected]> wrote:

 Subject: Re: [android-developers] Using "findViewbyId' in Broadcast Receiver
 To: [email protected]
 Date: Wednesday, January 25, 2017, 10:57 AM
 
 
 --------------------------------------------
 On Wed, 1/25/17, sardar khan <[email protected]>
 wrote:
 
  Subject: Re: [android-developers] Using "findViewbyId' in
 Broadcast Receiver
  To: "[email protected]"
 <[email protected]>
  Date: Wednesday, January 25, 2017, 7:31 AM
  
  You can
  launch an Activity through broadcast receiver. that can
  change the textview colour..
  On Sun, Jan 15, 2017 at
  4:02 AM, abdullah zaman <[email protected]>
  wrote:
  How can I
  use findViewById() in a
  Broadcast Receiver class. Below is my code snippet. I get
  the error message: "can't resolve method
  findViewById" if used directly without class
  constructor (because find View by Id is Activity method
 and
  cant be used in Broadcast Receiver i suppose) . And if i
 try
  to use the class constructor (Where the imageView is
  available in my main activity) my app crashes saying "
  Unfortunately app has stopped" .
   I just
  want to change the color of ImageView e.g "from black
  to blue" in the below if statement if it is possible by
  any other means pleas let me know.
  This is my
  Broadcast Receiver classpublic class MyBroadcastReceiver
 extends FirstBroadcastReceiver {
  Context context;
  Activity activity;
  public MyBroadcastReceiver(Context context, Activity
 activity){
      this.context=context;   
 
      this.activity=activity;
  }
  
      @Override
      protected void (Context context) {
      // content
      }
  
      @Override
      public void onButton(Context
 context, boolean isClick) {
  
          if(isClick) {
  
      ImageView blueImage = (ImageView)
 activity.findViewById(R.id.ima geView);
      blueImage.setColorFilter(0xff0
 00000);
           }
      }
  .......
  ....
      // and so
  onAnd this is my Main Activity
  public class MainActivity extends AppCompatActivity {
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceSt
 ate);
      setContentView(R.layout.activi
 ty_main);
       // and so on
      }
  }
  
  
  MyBroadcastReceiver myBroadcastReceiver
  = new MyBroadcastReceiver(MainActivi ty.this,this);
  
   @Override
   public void onActivityResult() {
    // some code
    }
  
  @Override
       public void onInitialized(MyManager
 manager){
   // some code   
   }
  
  
  
  
  -- 
  
  You received this message because you are subscribed to
 the
  Google Groups "Android Developers" group.
  
  To unsubscribe from this group and stop receiving emails
  from it, send an email to android-developers+
  [email protected].
  
  To post to this group, send email to android-developers@
  googlegroups.com.
  
  Visit this group at https://groups.google.com/
  group/android-developers.
  
  To view this discussion on the web visit https://groups.google.com/d/
  msgid/android-developers/ 31c0874e-3c84-4f1a-b17d-
  85cde28741ec%40googlegroups. com.
  
  For more options, visit https://groups.google.com/d/
  optout.
  
  
  
  
  
  
  -- 
  
  You received this message because you are subscribed to
 the
  Google Groups "Android Developers" group.
  
  To unsubscribe from this group and stop receiving emails
  from it, send an email to [email protected].
  
  To post to this group, send email to [email protected].
  
  Visit this group at
 https://groups.google.com/group/android-developers.
  
  To view this discussion on the web visit
 
https://groups.google.com/d/msgid/android-developers/CABHzXAS_bVowxdvomLrnL3aJTyYutyFHGRVXnL_RCbh0bBvcVQ%40mail.gmail.com.
  
  For more options, visit
 https://groups.google.com/d/optout.
  xti a si metalurgica. Nivelul operatiilor financiare era
 redus in comparatie cu cel
 
 -- 
 You received this message because you are subscribed to the
 Google Groups "Android Developers" group.
 To unsubscribe from this group and stop receiving emails
 from it, send an email to [email protected].
 To post to this group, send email to [email protected].
 Visit this group at
 https://groups.google.com/group/android-developers.
 To view this discussion on the web visit
 
https://groups.google.com/d/msgid/android-developers/571871901.459154.1485334677277%40mail.yahoo.com.
 For more options, visit
 https://groups.google.com/d/optout.n aceasta zona se vor desfasura  in zilele 
de 12-17 septembrie 1924  infruntari sangeroase intre forte infiltrate din 
U.R.S.S.  dublate de simpatizanti de la fata locului  si trupe ale armatei 
romane  care s-au soldat cu morti si raniti.

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/1810932428.349456.1485337724970%40mail.yahoo.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to