Android EditText over NativeActivity: long press popup tap doesn't work on some device
Asked Answered
V

0

7

I looking for help with strange issue in Android UI. I have a NativeActivity, subclassed in Java, like this:

public class MainActivity extends NativeActivity {
...

in AndroidManifest.xml:

<activity android:name="textactivity" android:screenOrientation="unspecified" android:configChanges="orientation|keyboardHidden|screenSize" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />

So it's EditText shown from C++ code via JNI. C++ code uses OpenGL ES for drawing.

EditText called by:

...
Intent ebintent=new Intent(this,EditBoxActivity.class);
ebintent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivityForResult(ebintent,ebrescode);

In EditText activity there is nothing special, like:

public class EditBoxActivity extends Activity {
...
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.editbox);
LinearLayout linearlayout=(LinearLayout)findViewById(R.id.linearLayoutEditBox);
linearlayout.setPadding(xpos,ypos,0,0);
edttext=(EditText)findViewById(R.id.editText);
edttext.getLayoutParams().width=width;
edttext.getLayoutParams().height=height;

And layout xml:

<LinearLayout 
    android:id="@+id/linearLayoutEditBox"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#00000000">
<EditText
        android:id="@+id/editText"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:lines="1"
        android:singleLine="true" />

Now my question. It works perfectly fine, on all devices, well not, actually there are some reports from Galaxy S8/S9 users, which updated to Android 9.0 Pie, that "I cannot paste, I tap but it doesn't work". I checked it by myself, on 8.0 it worked perfectly fine on my Galaxy S9, now I updated to 9.0 and: long press on EditText, popup shown, it says "Paste", but I tap paste, but tap doesn't work, at all... I tried other apps. There are not many apps like mine. Most of them use Java only. They work and have no issues. For me it looks like bug in Android framework modified by Samsung. How do You think, have I any hope to get some workaround. I want paste text in my simple textbox, nothing special.

I tried create PopupWindow with EditBox in it, but paste popup is not displayed for unknown reason.

I tried to use AppCompatActivity with AppCompatEditText, it looks the same as other apps, but paste popup still does nothing.

Venenose answered 13/5, 2019 at 5:27 Comment(6)
I changed some names in code above. Please don't write me, they are wrong, they perfectly fine in my code I using.Venenose
setTextIsSelectable(true) and use this too android:cursorVisible="true", can you check thatDryasdust
@notTdar thank You for response. I tried it but, it still the same. Paste popup is shown, when I tap it nothing happens. Touches outside EditText have no effect. When I tap inside textbox, paste popup closes. When I use clipboard inside keyboard, I can paste text to textbox. Just paste popup doesn't work. Happens only on Galaxy updated to 9.0.Venenose
okay, that's unexpected, android.cursorVisisble, for this command, just type something in edittext then try to paste againDryasdust
@notTdar tried it. it has same effect. I guess not a problem in my code, but Samsung bug, with some workaround needed.Venenose
that's unfortunate, I don't have a Samsung device to check it up for you.Dryasdust

© 2022 - 2024 — McMap. All rights reserved.