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

  • Home
  • SEARCH
  • 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 7770479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:25:11+00:00 2026-06-01T16:25:11+00:00

I’m trying to create an interface for a launcher app that can be traversed

  • 0

I’m trying to create an interface for a launcher app that can be traversed using only a d-pad. My layout is hierarchical, with each top level item having a list of options. To navigate to this second list, the user would either be able to press the item, or press right.

The problem is, that because of the way Android determines the correct view to focus based on location, the cursor jumps to the incorrect item (what ever is directly next to the cursor). Refer to figure 1 below; if the user were to press right, Dev Tools would be highlighted instead of API Demos.

The same goes for going back to the left. In figure 2, when the user presses right, Music would be selected instead of Applications.

example of layout

So far I’ve tried the following to manually select the correct view:

appListView.setOnFocusChangeListener(new OnFocusChangeListener() {
    @Override
    public void onFocusChange(View v, boolean hasFocus) {
        if(hasFocus) {
            ((ListView) v).getChildAt(0).requestFocus();
        } else {
            findViewById(R.id.apps_button).requestFocus();
        }
    }
});

This fails (I assume) because the dpad action has already fired a requestFocus, and I’ve verified that I’m getting the right child view, that the child view is focusable, and that requestFocus() returns false;

What can I do to make this work as expected? Thanks in advance 🙂

EDIT 1:

I also just tried setting the application buttons NextFocusRightId to the first item of the list view (which is set programatically by the list adapter @ position 0); nothing.

EDIT 2:
NextFocus___Id is working on these buttons too, since Videos’ up focus is Settings, which works fine…

  • 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-01T16:25:12+00:00Added an answer on June 1, 2026 at 4:25 pm

    I finally figured it out!

    Manually focusing list items is best done through the ListView itself. It works cleanly going to the right by extending the ListView class with the following change:

    @Override
    protected void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect) {
        if(gainFocus) {
            setSelection(0);
        } else {
            super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);
        }
    }
    

    and to the left by just setting the NextFocusLeft of the listview (not the items) as such:

    appListView.setNextFocusLeftId(R.id.apps_button);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I'm trying to create an if statement in PHP that prevents a single post
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I am using Paperclip to handle profile photo uploads in my app. They upload
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function

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.