Crash when trying to add to dictionary within a Dialog

by Horchata Factory » Fri, 18 Sep 2009 02:33:36 GMT


Sponsored Links
 I have a custom dialog which contains an EditText control in it. If I
type something inside it, do a long press, and choose to add the word
to the dictionary, it crashes with this exception:

09-17 18:03:35.765: WARN/dalvikvm(994): threadid=3: thread exiting
with uncaught exception (group=0x4000fe70)
09-17 18:03:35.775: ERROR/AndroidRuntime(994): Uncaught handler:
thread main exiting due to uncaught exception
09-17 18:03:35.775: ERROR/AndroidRuntime(994):
android.util.AndroidRuntimeException: Calling startActivity() from
outside of an Activity  context requires the FLAG_ACTIVITY_NEW_TASK
flag. Is this really what you want?
09-17 18:03:35.775: ERROR/AndroidRuntime(994):     at
android.app.ApplicationContext.startActivity(ApplicationContext.java:
627)
09-17 18:03:35.775: ERROR/AndroidRuntime(994):     at
android.content.ContextWrapper.startActivity(ContextWrapper.java:236)
09-17 18:03:35.775: ERROR/AndroidRuntime(994):     at
android.widget.TextView.onTextContextMenuItem(TextView.java:6961)
09-17 18:03:35.775: ERROR/AndroidRuntime(994):     at
android.widget.TextView$MenuHandler.onMenuItemClick(TextView.java:
6853)
09-17 18:03:35.775: ERROR/AndroidRuntime(994):     at
com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:
133)
09-17 18:03:35.775: ERROR/AndroidRuntime(994):     at
com.android.internal.view.menu.MenuBuilder.performItemAction
(MenuBuilder.java:813)
09-17 18:03:35.775: ERROR/AndroidRuntime(994):     at
com.android.internal.view.menu.MenuDialogHelper.onClick
(MenuDialogHelper.java:120)
09-17 18:03:35.775: ERROR/AndroidRuntime(994):     at
com.android.internal.app.AlertController$AlertParams$3.onItemClick
(AlertController.java:884)
09-17 18:03:35.775: ERROR/AndroidRuntime(994):     at
android.widget.AdapterView.performItemClick(AdapterView.java:283)
09-17 18:03:35.775: ERROR/AndroidRuntime(994):     at
android.widget.ListView.performItemClick(ListView.java:3132)
09-17 18:03:35.775: ERROR/AndroidRuntime(994):     at
android.widget.AbsListView$PerformClick.run(AbsListView.java:1620)
09-17 18:03:35.775: ERROR/AndroidRuntime(994):     at
android.os.Handler.handleCallback(Handler.java:587)
09-17 18:03:35.775: ERROR/AndroidRuntime(994):     at
android.os.Handler.dispatchMessage(Handler.java:92)
09-17 18:03:35.775: ERROR/AndroidRuntime(994):     at
android.os.Looper.loop(Looper.java:123)
09-17 18:03:35.775: ERROR/AndroidRuntime(994):     at
android.app.ActivityThread.main(ActivityThread.java:3948)
09-17 18:03:35.775: ERROR/AndroidRuntime(994):     at
java.lang.reflect.Method.invokeNative(Native Method)
09-17 18:03:35.775: ERROR/AndroidRuntime(994):     at
java.lang.reflect.Method.invoke(Method.java:521)
09-17 18:03:35.775: ERROR/AndroidRuntime(994):     at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:782)
09-17 18:03:35.775: ERROR/AndroidRuntime(994):     at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
09-17 18:03:35.775: ERROR/AndroidRuntime(994):     at
dalvik.system.NativeStart.main(Native Method)

Is there a way to have a custom dialog with an EditText that won't
throw an exception when the user adds a word to the dictionary? I know
I can remove that option if I set the inputType to "textEmailAddress",
but in my case, I must set inputType to "textPersonName"
--~--~---------~--~----~------------~-------~--~----~



Crash when trying to add to dictionary within a Dialog

by Horchata Factory » Tue, 22 Sep 2009 04:47:02 GMT


 esolved it by passing in the Activity context instead of Application
context to the dialog.

On Sep 17, 11:15am, Horchata Factory
<horchatafactorysupp...@gmail.com> wrote:
--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. Android 1.5 (Cupcake) permissions on Location/GPS settings

FYI (not advocating any particular solution) you can just grab the
rc33 'full' update off any number of mirrors (not the patch version)
and apply it as an update.zip. You will probably have to downgrade the
radio also, but that should be available in the same place (or
possibly bundled in the same update.)






--~--~---------~--~----~------------~-------~--~----~

2. VerifyError on Custom View

I have setup remote crash reports for unhandled java exceptions.  I am
getting lots of users who are crashing right on startup, and I'm
seeing VerifyErrors that look like they are thrown right on startup.

I have tested this app extensively on 1.1 and 1.5 on many different
devices, but some phone just have this problem everytime,
unfortunately I haven't been able to get my hands on one that it
crashes on to see what else is happening in LogCat.

Anyways, the exception looks like this:

java.lang.VerifyError: com.tunewiki.lyricplayer.android.views.TopBar
       at java.lang.Class.getDeclaredConstructors(Native Method)
       at java.lang.Class.getConstructor(Class.java:401)
       at android.view.LayoutInflater.createView(LayoutInflater.java:
470)
       at android.view.LayoutInflater.createViewFromTag
(LayoutInflater.java:560)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:
613)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:403)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:316)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:272)
       at com.android.internal.policy.impl.PhoneWindow.setContentView
(PhoneWindow.java:227)
       at android.app.Activity.setContentView(Activity.java:1569)
       at
com.tunewiki.lyricplayer.android.library.MainLibraryActivity.onCreate
(MainLibraryActivity.java:21)
       at android.app.Instrumentation.callActivityOnCreate
(Instrumentation.java:1122)
       at android.app.ActivityThread.performLaunchActivity
(ActivityThread.java:2103)
       at android.app.ActivityThread.startActivityNow
(ActivityThread.java:1988)
       at android.app.LocalActivityManager.moveToState
(LocalActivityManager.java:122)
       at android.app.LocalActivityManager.startActivity
(LocalActivityManager.java:335)
       at
com.tunewiki.lyricplayer.android.tabs.TabHostActivity.setCurrentTab
(TabHostActivity.java:359)
       at com.tunewiki.lyricplayer.android.MainActivity.setCurrentTab
(MainActivity.java:687)
       at
com.tunewiki.lyricplayer.android.tabs.TabHostActivity.setCurrentTab
(TabHostActivity.java:259)
       at
com.tunewiki.lyricplayer.android.tabs.TabHostActivity.setDefaultTab
(TabHostActivity.java:67)
       at com.tunewiki.lyricplayer.android.MainActivity.onCreate
(MainActivity.java:268)
       at android.app.Instrumentation.callActivityOnCreate
(Instrumentation.java:1122)
       at android.app.ActivityThread.performLaunchActivity
(ActivityThread.java:2103)
       at android.app.ActivityThread.handleLaunchActivity
(ActivityThread.java:2156)
       at android.app.ActivityThread.access$1800(ActivityThread.java:
112)
       at android.app.ActivityThread$H.handleMessage
(ActivityThread.java:1580)
       at android.os.Handler.dispatchMessage(Handler.java:88)
       at android.os.Looper.loop(Looper.java:123)
       at android.app.ActivityThread.main(ActivityThread.java:3742)
       at java.lang.reflect.Method.invokeNative(Native Method)
       at java.lang.reflect.Method.invoke(Method.java:515)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:739)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497)
       at dalvik.system.NativeStart.main(Native Method)

TopBar extends RelativeLayout.

Thanks,
Zach

--~--~---------~--~----~------------~-------~--~----~

3. Binder internals for IPC

4. PreferenceActivity, can a checkbox and a checkbox preference share?

5. How to know whether a table already exist in database?

6. Strange Layout Bug

7. Finish all previous Activities?