Hello In my android application i am focusing the clicked row when the user clicks on back keypress.But my issueis like when i click on the row its first getting focused and then on another click it navigates to another page.
Below is my code
public void onClick(View v) { // TODO Auto-generated method stub
((TableRow)v).setFocusableInTouchMode(true);
((TableRow)v).requestFocus();
v.startAnimation(anim);
if(v.getId()==1)
{
Intent i = new Intent(TableImageLayout.this, TableImageLayout2.class);
startActivity(i);
//((TableRow)v).setBackgroundColor(Color.rgb(255, 180, 40));
}
if(v.getId()==3)
{
Intent i = new Intent(TableImageLayout.this, TableImageLayout3.class);
startActivity(i);
}
if(v.getId()==5)
{
Intent i = new Intent(TableImageLayout.this, TableImageLayout4.class);
startActivity(i);
}
if(v.getId()==7)
{
Intent i = new Intent(TableImageLayout.this, TableImageLayout5.class);
startActivity(i);
}
if(v.getId()==100)
{
Intent i = new Intent(TableImageLayout.this, TableImageLayout5.class);
startActivity(i);
}
}
@Override
public void onFocusChange(View v, boolean hasFocus) {
// TODO Auto-generated method stub
if(hasFocus)
{
((TableRow)v).setBackgroundColor(Color.rgb(255, 180, 40));
}
else
{((TableRow)v).setBackgroundColor(Color.BLACK);}
}
Please let me know your valuable methods.
Thanks in advance :)