Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Keyboard not showing #51

Open
adaonder opened this issue Mar 5, 2020 · 15 comments
Open

Bug: Keyboard not showing #51

adaonder opened this issue Mar 5, 2020 · 15 comments

Comments

@adaonder
Copy link

adaonder commented Mar 5, 2020

  • PinView type number but it did not open when I click.
Info:
  • PinView version: 1.4.3
  • Device OS version: Android 7.0
  • Device Name: Tablet: reeeder_T8
@rajatpathak
Copy link

rajatpathak commented Mar 7, 2020

android:focusable="true"
android:focusableInTouchMode="true"
add this

@rushabh13
Copy link

@rajatpathak, Given solution is not working.

@ram992
Copy link

ram992 commented Mar 16, 2020

Any update ?, Same thing is happening with me

@ilhammhdd
Copy link

same issue here

@ChaosLeung
Copy link
Owner

Can anyone provide the reproduction steps? I tried to reproduce it on Android emulator 4.4 / 5.0 / 5.1 / 8.0 / 9.0, but it works perfect.

@ilhammhdd
Copy link

in my case i forgot to follow step 2 in the wiki

@akorb
Copy link

akorb commented Sep 25, 2020

I have the same problem. I want to open the keyboard automatically when the Activity starts.

MainActivity.cs

public class MainActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        PinView pinView = findViewById(R.id.pinView);
        pinView.requestFocus();

        InputMethodManager inputManager = (InputMethodManager) pinView.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
        inputManager.showSoftInput(pinView, InputMethodManager.SHOW_IMPLICIT);
    }
}

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity">

    <com.chaos.view.PinView
        android:id="@+id/pinView"
        style="@style/PinWidget.PinView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">

        <requestFocus />
    </com.chaos.view.PinView>
</LinearLayout>

build.gradle

implementation 'com.chaos.view:pinview:1.4.4'

The PinView is in focus (the cursor is visible) but the keyboard does not show up.

This example reproduces the bug for my phone (Android 10) and on my emulator "Pixel 2 API 16".

I hope this helps.

@nixfuerdiecharts
Copy link

For me, these two solutions are working

pinView.requestFocus();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(pinView, InputMethodManager.SHOW_IMPLICIT);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);

or

pinView.dispatchTouchEvent(MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis(), MotionEvent.ACTION_DOWN , 0, 0, 0));
pinView.dispatchTouchEvent(MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis(), MotionEvent.ACTION_UP , 0, 0, 0));
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);

@zakrodionov
Copy link

Same problem

@aryant-nigam
Copy link

but how to get This done if i have custom dilog box where i have placed this pinview

@erinfolami
Copy link

android:focusable="true"
android:focusableInTouchMode="true"
add this

this worked for me

@vikranz
Copy link

vikranz commented Mar 13, 2022

Same problem on 1.4.4 and try all solution of the all comment above still not working (Android 10 & pixel 5)

@Braimah-Abiola
Copy link

android:focusable="true"
android:focusableInTouchMode="true"
add this

this worked for me

Yeah works for me too

@Musnadil
Copy link

android:focusable="true"
android:focusableInTouchMode="true"
add this

this worked for me

Yeah works for me too

works for me too

@thisizankushk
Copy link

android:focusable="true"
android:focusableInTouchMode="true"
add this

this worked for me

Yeah works for me too

works for me too

me too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests