We may handle different view, sometimes it is inconvinient if we don't know the view type. Just use "instanceof" to know what kind of view type would coming.
View view = findViewById(R.id.viewid);
if(view instanceof EditText)
Log.v("debug", "EditText");
else if(view instanceof TextView)
Log.v("debug", "TextView");
else
Log.v("debug","Wrong Type"+i);

0 意見:
張貼留言