android - callback method for soft keyboard changes? -


is there callback methods soft keyboard , down. want action when soft keyboard , down. know check whether keyboard or down. should call method somewhere. here don't want call it. should triggered automatically when there change in soft keyboard state.

try code worked in project

r.id.activityroot parentlayout id

final view activityrootview = findviewbyid(r.id.activityroot);             activityrootview.getviewtreeobserver().addongloballayoutlistener(                     new ongloballayoutlistener() {                         @override                         public void ongloballayout() {                              try {                                 int heightdiff = activityrootview.getrootview()                                         .getheight() - activityrootview.getheight();                                 if (heightdiff > 100) { // if more 100 pixels,                                                         //                                                         // keyboard...                                 //do stuff here keyboard shown                                 }else {     //do stuff here keyboard not visible }                              } catch (nullpointerexception e) {                                 e.printstacktrace();                             } catch (exception e) {                                 e.printstacktrace();                             }                         }                      }); 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -