Closed hssm closed 8 years ago
Android 2.1
Reported by Ingmar.Zech
on 2011-08-13 12:55:51
I'm able to consistently reproduce the crash by tapping the "OK" button on the card.
Log here: http://www-personal.umich.edu/~mikemorr/20110813log-720.txt
Reported by mikemorr.com
on 2011-08-13 14:39:36
Thanks for looking into it!
Interestingly, Ankidroid can handle
<iframe id="myFrame"; src="'a.html'"; height="480px"; width="66%"; frameborder="0";
scrolling="yes";></iframe>
just fine (loads a.html on startup), while Anki 1.2.8 cannot.
So I guess it's <input> causing this error.
08-13 10:31:30.741 I/AnkiDroid( 1609): Focusable = true, Focusable in touch mode =
false
...
08-13 10:31:35.327 I/UsageStats( 1216): Unexpected resume of com.android.launcher while
already resumed in com.ichi2.anki
08-13 10:31:35.374 W/InputManagerService( 1216): Got RemoteException sending setActive(false)
notification to pid 1609 uid 10027
Reported by Ingmar.Zech
on 2011-08-15 11:47:08
With 0.7beta23 (fixing Issue 725), I no longer get a crash when tapping the "OK" button.
However, I am still unable to enter text into the textbox. Tapping inside the box makes
a blinking cursor appear, but even when I force the onscreen keyboard to appear (by
a long press on the Menu button), I can't type text into the box.
Reported by mikemorr.com
on 2011-08-16 03:30:28
Hopefully the crash issue is fixed, so I'm renaming this issue (from "Crash on using
textinput or iframe") to describe the other problem (can't type into input box).
Attached is a simple deck with only <input /> on each side of the card. I'm unable
to focus the text input box, make a cursor appear in it, or type into it.
Reported by mikemorr.com
on 2011-08-16 05:08:06
Reported by nicolas.raoul
on 2011-08-16 05:18:14
Accepted
I'm on 0.7 now. Sometimes I can type into the input field. Most of the time, it doesn't
work (or even surcharges my input keyboard). I made it work (but only once) just by
changing from landscape to portrait mode. Would be great to see this working the whole
time.
Reported by Ingmar.Zech
on 2011-08-24 18:18:07
This really seems to be Android's Issue 7189: WebView with input/textarea never get
virtual keyboard focus.
Found 2 different solutions so far (ranked by quality of success-stories):
1) Overriding onCheckIsTextEditor():
class MyWebView extends WebView {
public MyWebView(Context context) {
super(context);
}
@Override
public boolean onCheckIsTextEditor() {
return true;
}
}
2a) Adding TouchListener:
webview.requestFocus(View.FOCUS_DOWN);
webview.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_UP:
if (!v.hasFocus()) {
v.requestFocus();
}
break;
}
return false;
}
});
2b) Adding android:focusable to WebView layout:
<WebView android:id="@+id/uiContent"
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:focusable="true"/>
(Sources: https://code.google.com/p/android/issues/detail?id=7189, http://stackoverflow.com/questions/4293965/android-webview-focus-problem)
Reported by Ingmar.Zech
on 2011-08-29 11:01:11
Unfortunately, this code part causes an npe for some devices (https://code.google.com/p/ankidroid/issues/detail?id=805):
@Override
public boolean onCheckIsTextEditor() {
return true;
}
I removed it when searching for the 805 error and it obviously solved the case.
I'd propose to add an option for html input boxes (with a hint that it does not work
on all devices) and disable it by default.
What do you think?
Reported by NorbertNagold
on 2011-10-06 08:15:40
Sounds good :-)
Reported by nicolas.raoul
on 2011-10-06 08:25:49
To allow for issue 805: This fix here is now disabled by default, you can enable it
in preferences/other. If the crash occurs (because you own one of the devices in question),
it will be automatically disabled again.
Anyway, it would be better to find a solution which works for everyone; so I keep this
issue open
Reported by NorbertNagold
on 2011-10-07 07:12:00
Is this still an issue in 2.x?
Reported by perceptualchaos2
on 2015-06-01 06:02:24
WaitingForFeedback
I still can’t get text into an <input> tag with API 8/Android 2.2.
Which is a shame, because otherwise my code to use an input tag for the type answer
feature is ready.
Reported by ospalh
on 2015-06-03 13:47:05
@ospalh This should finally be obsolete, right?
Well, it’s still not working. You can’t reliably get focus into an input box on old Android systems, when you have one in your card templates. But it’s not really an AnkiDroid, but an Android or Webview problem. So i guess we can close this as “won’t fix”.
And the type-in feature is only slightly related to this, and working all right with the extra input field.
Originally reported on Google Code with ID 720
Reported by
Ingmar.Zech
on 2011-08-13 12:23:16