So i declare

ImageView imgView;
ImageView imgView1;

in onCreate:

imgView = (ImageView)findViewById(R.id.imageView);
imgView.setBackgroundResource(R.drawable.frame_animation);

imgView1 = (ImageView)findViewById(R.id.imageView1);
imgView1.setBackgroundResource(R.drawable.frame_animation);

imgView.setVisibility(View.INVISIBLE); //set imgView invisible

then later:

class SoundTimeTask extends TimerTask {


                public void run() {

                        switch (warning) {
                        case 0:
                                imgView.setVisibility(View.VISIBLE);
                                frameAnimation = (AnimationDrawable) 
imgView.getBackground();
                                frameAnimation.start();


break;
...............

does anyone see anything wrong with that? imgView never appears?

Thanks,

 David



On Sep 25, 10:30 pm, Kingcrowley <kingcrow...@gmail.com> wrote:
> HI,
>
> my code seems similar to yours..but doesn't work..could you copy/paste
> in yours if it isn't too long?
>
> Thanks a lot
>
> David
>
> On Sep 25, 9:01 pm, Carmen Delessio <carmendeles...@gmail.com> wrote:
>
> > I've got a example with a TextView and EditView where I do this
> > successfully.
> > Seehttp://developer.android.com/reference/android/view/View.html#setVisi...
> > is where View.VISIBLE is defined.
> > Just noticed View.GONE.  that could be helpful.
>
> > Define TextView and EditText:
> >     TextView adminLabel;
> >     EditText admin;
>
> > Assign from Layout:
> >         adminLabel = (TextView)findViewById(R.id.AdminLabel);
> >         admin = (EditText)findViewById(R.id.Admin);
>
> > Set to invisible:
> >         admin.setVisibility(View.INVISIBLE);
> >         adminLabel.setVisibility(View.INVISIBLE);
>
> > Set to visible:
> >     admin.setVisibility(View.VISIBLE);
> >     adminLabel.setVisibility(View.VISIBLE);
>
> > --
> > Carmenhttp://www.twitter.com/CarmenDelessiohttp://www.talkingandroid.comhtt...
>
> > On Fri, Sep 25, 2009 at 3:49 PM, Kingcrowley <kingcrow...@gmail.com> wrote:
>
> > > I was wondering how this works,
>
> > > I can set ImageViews VISIBLE or INVISIBLE in OnCreate, but i can't
> > > seem to do it anywhere else properly?
> > > using code like "imgView.setVisibility(ImageView.VISIBLE);"
> > > any pointers/advice?
>
> > > Thanks,
>
> > > David
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to