java - why eclipse shows error The Application has stopped unexpectedly. Please try again in a class InputMethodManager? -


i have problem android application. want run project inputmethodmanager class, eclipse show me error the application has stopped unexpectedly.

i don't use method's, create instance of inputmethodmanager. don't know what's wrong.

my code:

private static inputmethodmanager inputmethodmanager;  private static edittext edittext;  private static string stringinstance; @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_input_method_manager);      if (savedinstancestate == null) {         getsupportfragmentmanager().begintransaction()                 .add(r.id.container, new placeholderfragment()).commit();     }      inputmethodmanager = (inputmethodmanager)getsystemservice(context.input_method_service);  } 

my error log:

06-27 16:03:11.631: e/phonepolicy(32): not preload class phone policy: com.android.internal.policy.impl.phonewindow$contextmenucallback 06-27 16:03:26.411: e/batteryservice(80): usbonlinepath not found 06-27 16:03:26.411: e/batteryservice(80): batteryvoltagepath not found 06-27 16:03:26.411: e/batteryservice(80): batterytemperaturepath not found 06-27 16:03:30.851: e/eventhub(80): not driver version /dev/input/mouse0, not typewriter 06-27 16:03:30.851: e/eventhub(80): not driver version /dev/input/mice, not typewriter 06-27 16:03:31.082: e/wifiservice(80): invoking mwifistatemachine.setwifienabled 06-27 16:03:32.541: e/throttleservice(80): not open gps configuration file /etc/gps.conf 06-27 16:03:32.551: e/networktimeupdateservice(80): not open gps configuration file /etc/gps.conf 06-27 16:03:32.551: e/networktimeupdateservice(80): ntp server address not found, not syncing ntp time 06-27 16:03:33.342: e/logwrapper(161): executing /system/bin/tc failed: no such file or directory 06-27 16:03:33.421: e/logwrapper(162): executing /system/bin/tc failed: no such file or directory 06-27 16:03:33.451: e/logwrapper(163): executing /system/bin/tc failed: no such file or directory 06-27 16:03:43.192: e/soundpool(80): error loading /system/media/audio/ui/effect_tick.ogg 06-27 16:03:43.192: e/soundpool(80): error loading /system/media/audio/ui/effect_tick.ogg 06-27 16:03:43.202: e/soundpool(80): error loading /system/media/audio/ui/effect_tick.ogg 06-27 16:03:43.202: e/soundpool(80): error loading /system/media/audio/ui/effect_tick.ogg 06-27 16:03:43.212: e/soundpool(80): error loading /system/media/audio/ui/effect_tick.ogg 06-27 16:03:43.262: e/soundpool(80): error loading /system/media/audio/ui/keypressstandard.ogg 06-27 16:03:43.272: e/soundpool(80): error loading /system/media/audio/ui/keypressspacebar.ogg 06-27 16:03:43.322: e/soundpool(80): error loading /system/media/audio/ui/keypressdelete.ogg 06-27 16:03:43.332: e/soundpool(80): error loading /system/media/audio/ui/keypressreturn.ogg 06-27 16:03:43.542: e/telephonymanager(80): hidden constructor called more once per process! 06-27 16:03:43.542: e/telephonymanager(80): original: android, new: android 06-27 16:03:59.692: e/androidruntime(378): fatal exception: main 06-27 16:03:59.692: e/androidruntime(378): java.lang.runtimeexception: unable start activity componentinfo{com.example.imm/com.example.imm.inputmethodmanager}: java.lang.classcastexception: android.view.inputmethod.inputmethodmanager cannot cast com.example.imm.inputmethodmanager 06-27 16:03:59.692: e/androidruntime(378):  @ android.app.activitythread.performlaunchactivity(activitythread.java:1748) 06-27 16:03:59.692: e/androidruntime(378):  @ android.app.activitythread.handlelaunchactivity(activitythread.java:1764) 06-27 16:03:59.692: e/androidruntime(378):  @ android.app.activitythread.access$1500(activitythread.java:122) 06-27 16:03:59.692: e/androidruntime(378):  @ android.app.activitythread$h.handlemessage(activitythread.java:1002) 06-27 16:03:59.692: e/androidruntime(378):  @ android.os.handler.dispatchmessage(handler.java:99) 06-27 16:03:59.692: e/androidruntime(378):  @ android.os.looper.loop(looper.java:132) 06-27 16:03:59.692: e/androidruntime(378):  @ android.app.activitythread.main(activitythread.java:4025) 06-27 16:03:59.692: e/androidruntime(378):  @ java.lang.reflect.method.invokenative(native method) 06-27 16:03:59.692: e/androidruntime(378):  @ java.lang.reflect.method.invoke(method.java:491) 06-27 16:03:59.692: e/androidruntime(378):  @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:841) 06-27 16:03:59.692: e/androidruntime(378):  @ com.android.internal.os.zygoteinit.main(zygoteinit.java:599) 06-27 16:03:59.692: e/androidruntime(378):  @ dalvik.system.nativestart.main(native method) 06-27 16:03:59.692: e/androidruntime(378): caused by: java.lang.classcastexception: android.view.inputmethod.inputmethodmanager cannot cast com.example.imm.inputmethodmanager 06-27 16:03:59.692: e/androidruntime(378):  @ com.example.imm.inputmethodmanager.oncreate(inputmethodmanager.java:35) 06-27 16:03:59.692: e/androidruntime(378):  @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1048) 06-27 16:03:59.692: e/androidruntime(378):  @ android.app.activitythread.performlaunchactivity(activitythread.java:1712) 06-27 16:03:59.692: e/androidruntime(378):  ... 11 more : e/(): device disconnected 

you imported wrong inputmethodmanager class, @ exception :

unable start activity componentinfo{com.example.imm/com.example.imm.inputmethodmanager}: java.lang.classcastexception: android.view.inputmethod.inputmethodmanager cannot cast com.example.imm.inputmethodmanager

just change import com.example.imm.inputmethodmanager; import android.view.inputmethod.inputmethodmanager; in top of java file.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -