Skip to content

Instantly share code, notes, and snippets.

@jpzhu
Last active December 23, 2015 23:19
Show Gist options
  • Save jpzhu/6709355 to your computer and use it in GitHub Desktop.
Save jpzhu/6709355 to your computer and use it in GitHub Desktop.
test code
private void addPresetButton(){
for(int i=0;i<6;i++){
mChannelButton[i] = (Button) findViewById(mChannelButtonId[i]);
mChannelButton[i].setOnClickListener(this);
mChannelButton[i].setOnLongClickListener(this);
}
}
@Override
public void onClick(View v) {
for(int i=0;i<6;i++){
if(v.getId() == mChannelButtonId[i]){
presetClickEvent(mChannelButton[i]);
}
}
}
@Override
public boolean onLongClick(View v) {
for(int i=0;i<6;i++){
if(v.getId() == mChannelButtonId[i]){
presetLongClickEvent(mChannelButton[i], mChannelButtonId[i], mTabName);
}
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment