Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

android get id of view

public void onClick(View v) {
    switch (v.getId()) {
    case R.id.add_04:
        Toast.makeText(MainActivity.this, "1", Toast.LENGTH_LONG).show();
        break;
    case R.id.add_05:
        Toast.makeText(MainActivity.this, "2", Toast.LENGTH_LONG).show();
        break;
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #android #id #view
ADD COMMENT
Topic
Name
5+4 =