I am working on image based project in which clicking next/back
buttons new images got loaded.ow how to give path dynamically.
private int imageCounter = 0;
private ImageView imageView;
@Override
public void onCreate(Bundle savedInstanceState)
{
setContentView(R.layout.frame0);//this one is the common parent
layout for all imageviews
super.onCreate(savedInstanceState);
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(R.drawable.image_wo_lbl_0);
}
@Override
public void onClick(View v)
{
int imagePath = 0;
// TODO Auto-generated method stub
switch (v.getId())
{
case R.id.next:
if(imageCounter < 25)
{
//imagePath = //need dynamic path to access
image from drawable
folder
}
break;
case R.id.back:
if(imageCounter > 0)
{
//imagePath =need help here
}
break;
}
this.loadImage(imagePath);
}
private void loadImage(int imagePath)
{
imageView.setImageResource(imagePath);
--
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