I am really really confused. How are you including the ImageView that
you have in the activity. I can see that you have created a new
ImageView through code, but haven't added it to the Activity anywhere.

On Nov 12, 5:21 pm, Alok Upadhyay <[email protected]> wrote:
> i have thirty images in my drawable folder.a layout having back and
> next buttons and having an imageview.now on clicking next and back
> buttons different-2 images displayed.my xml code is:
> <?xml version="1.0" encoding="utf-8"?>
> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
>     android:orientation="vertical"
>     android:layout_width="fill_parent"
>     android:layout_height="fill_parent"
>         android:gravity="center"
>     >
>     <ImageButton
>    android:id="@+id/back"
>    android:src="@drawable/btn_back"
>    android:layout_width="wrap_content"
>    android:layout_height="wrap_content"
>    android:layout_gravity="left"
>    />
>    <ImageButton
>    android:id="@+id/next"
>    android:src="@drawable/btn_next"
>    android:layout_width="wrap_content"
>    android:layout_height="wrap_content"
>    android:layout_gravity="right"
>    />
>    <ImageView
>    android:id="@+id/imageWoL0"
>    android:layout_width="wrap_content"
>    android:layout_height="wrap_content"
>    android:layout_gravity="left"
>
>    />
>
>    </LinearLayout>
>
> java code as:
> private int imageCounter = 0;
>         private ImageView imageView;
>
>         private int[] imageArray = {R.drawable.image_w_lbl_0,
> R.drawable.image_w_lbl_1,};
>         @Override
>         public void onCreate(Bundle savedInstanceState)
>         {
>                 setContentView(R.layout.parent_frame);//this one is the common
> parent layout for all imageviews
>                 super.onCreate(savedInstanceState);
>
>                 requestWindowFeature(Window.FEATURE_NO_TITLE);
>                 
> getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
>                 WindowManager.LayoutParams.FLAG_FULLSCREEN);
>
>                 imageView = new ImageView(this);
>
>                 ImageButton next = (ImageButton) findViewById(R.id.next);
>                 ImageButton back = (ImageButton) findViewById(R.id.back);
>                 next.setOnClickListener(this);
>                 back.setOnClickListener(this);
>                 //show the default image
>                 this.loadImage(imageArray[imageCounter]);
>
>         }
>         @Override
>         public void onClick(View v)
>         {
>                 int imagePath = 0;
>                 // TODO Auto-generated method stub
>                 switch (v.getId())
>                 {
>                 case R.id.next:
>                         Log.i("Tag","tag");
>                         if(imageCounter < 25)
>                         {
>
>                                 imagePath = imageArray[imageCounter];
>                         }
>                         imageCounter++;
>                         break;
>                 case R.id.back:
>                         if(imageCounter > 0)
>                         {
>                                 //imagePath =
>                         }
>                         break;
>                 }
>                 this.loadImage(imagePath);
>
>         }
>
>         private void loadImage(int imagePath)
>         {
>                 imageView.setImageResource(imagePath);
>                 //imageView.findViewById(R.id.imageWoL0);
>                 //imageView.
>         }
> the problem is that i am not getting imageview means my first image
> R.drawable.image_w_lbl_0(see above array) is not being loaded.
> any help will be appreciated

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to