Skip to content

Instantly share code, notes, and snippets.

@meditat
Created March 3, 2017 14:10
Show Gist options
  • Save meditat/c81d98040dc4aa990f6bcd327496e28c to your computer and use it in GitHub Desktop.
Save meditat/c81d98040dc4aa990f6bcd327496e28c to your computer and use it in GitHub Desktop.
how to directy use on click option in xml on android studio
public int counter=0 ;
public void submitOrder(View view){
counter++;
displayPri(counter);
displayQty(counter);
}
public void displayPri(int counter){
int coff=5;
TextView pri=(TextView)findViewById(R.id.price_text_view);
counter=5*counter;
String p=Integer.toString(counter);
pri.setText("$"+p);
}
public void displayQty(int counter){
TextView qty =(TextView)findViewById(R.id.quantity_text_view);
String s=Integer.toString(counter);
qty.setText(s);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment