Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9243039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:43:10+00:00 2026-06-18T08:43:10+00:00

With the following code I can list the inputDevices connected to Android device. public

  • 0

With the following code I can list the inputDevices connected to Android device.

public void onClick(View v) {
    if(v==mConnect){
        Toast.makeText(MainActivity.this, "TESTE", Toast.LENGTH_LONG).show();
        Log.d("INPUTDEVICES", "111111111111111111111");
        int[] teste;
        teste = new int[10];

        for(int i=0;i<5;i++){
        teste[i]=-1;
        }

        teste = InputDevice.getDeviceIds();
        for(int i=0;i<5;i++){
            Log.d("TESTE", Integer.toString(teste[i]));
            Log.d("TESTEE",InputDevice.getDevice(teste[i]).getName());
        }


    }
}

D/INPUTDEVICES( 6572): 111111111111111111111
D/TESTE   ( 6572): 1
D/TESTEE  ( 6572): Phone_key
D/TESTE   ( 6572): 3
D/TESTEE  ( 6572): ssd253x-ts
D/TESTE   ( 6572): 4
D/TESTEE  ( 6572): sun4i-keyboard
D/TESTE   ( 6572): 5
D/TESTEE  ( 6572): axp20-supplyer
D/TESTE   ( 6572): 8
D/TESTEE  ( 6572): Logitech USB Keyboard

Now I want to wait for text from a specific input device, in this case the input device 8 – Logitech USB Keyboard.
Can you help me with that?

Thanks 🙂

EDIT

I want something like that:

@Override
public boolean dispatchKeyEvent(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.KEYCODE_ENTER) {
    Toast.makeText(UITestsActivity.this,
               "YOU CLICKED ENTER KEY",
                Toast.LENGTH_LONG).show();
        return true;
    }
    return super.dispatchKeyEvent(e);
};

but that works for all keyboard keys like ‘a’,’b’,’c’,…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T08:43:12+00:00Added an answer on June 18, 2026 at 8:43 am

    You can use the method getDeviceId() from the KeyEvent class to filter for your desired keyboard:

    http://developer.android.com/reference/android/view/KeyEvent.html#getDeviceId%28%29

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone explane the following code for me? public class StoreEditorViewModel { public List<Ticket>
I can load a list with the following code String[] projection = new String[]
I have the following code: public interface IDrilldown { void AddCriteria<T>(T Criterion); } public
in Android list view can we set some value to each row just like
I am using following code to get List from xml file - public static
I can not initialize a List as in the following code: List<String> supplierNames =
Can someone explain the following code to me. As in why is List and
How can I make the following code be a list of links instead of
I have the following code: public List<anEntity> Get(int page, int pagesize, Func<anEntity, IComparable> orderby)
How can be the following code converted to linq or predicate expression: List<int> list1

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.