I'm using the following code to update an image switcher and corresponding strings when the next button is clicked,but I'm having trouble referencing the strings from the res/strings folder in the GetMyString().
For example one of my strings is named cutString.How do I reference it instead of YOUR_STRING_01? Is there a simple way to do call the string or is there a flaw in this implementation?
btnNext.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
currentIndex++;
// If index reaches maximum reset it
if(currentIndex==messageCount)
currentIndex=0;
imageSwitcher.setImageResource(imageIds[currentIndex]);
tView.setText(getMyString(clicks++));
}
});
//method called to update textview strings.
public String getMyString(int variable){
switch(variable){
case 1:
return YOUR_STRING_01;
break;
case 2:
return YOUR_STRING_02;
break;
case 3:
return YOUR_STRING_03;
break;
}