I am developing a quotes app that has next/previous, and copy buttons.
this is the code :
Button btn1;
String countires[];
int i=0;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.prob2);
btn1 = (Button) findViewById(R.id.prob2_btn1);
countires = getResources().getStringArray(R.array.country);
for (String string : countires)
{
Log.i("--: VALUE :--","string = "+string);
}
btn1.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View arg0)
{
// TODO Auto-generated method stub
String country = countires[i];
btn1.setText(country);
i++;
if(i==countires.length)
i=0;
}
});
}
I need the onClick code for "previous" button to show previous string in textView ???