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 7560763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:59:11+00:00 2026-05-30T12:59:11+00:00

im having a bit troubled here. I cannot seem to understand what’s the problem

  • 0

im having a bit troubled here. I cannot seem to understand what’s the problem here. can you guys please help me? what should I do? I copied this code from here. and tried to save the project. but im having an error and it says “The method onKeyDown(int, KeyEvent) is undefined for the type object”
I am building an app with eclipse and PhoneGap 1.3.1 with jQuery 1.2.6,

Here are the code

package com.phonegap.mobilemone;
import com.phonegap.DroidGap;
import android.view.KeyEvent;
import android.content.Context;
import android.view.inputmethod.InputMethodManager;
import android.webkit.WebView;

public class KeyBoard 
{

    private WebView mAppView;
    private DroidGap mGap;

    public KeyBoard(DroidGap gap, WebView view)
    {
        mAppView = view;
        mGap = gap;
    }

    public void showKeyBoard()
    {
        InputMethodManager mgr = (InputMethodManager)mGap.getSystemService(Context.INPUT_METHOD_SERVICE);
        // only will trigger it if no physical keyboard is open
        mgr.showSoftInput(mAppView, InputMethodManager.SHOW_IMPLICIT);

        ((InputMethodManager)mGap.getSystemService(Context.INPUT_METHOD_SERVICE)).showSoftInput(mAppView, 0); 

    }

    public void hideKeyBoard() 
    {
        InputMethodManager mgr = (InputMethodManager) mGap.getSystemService(Context.INPUT_METHOD_SERVICE);
        mgr.hideSoftInputFromWindow(mAppView.getWindowToken(), 0);
    }

    public boolean onKeyDown(int keyCode, KeyEvent event)
    {
        if (keyCode == KeyEvent.KEYCODE_BACK)
        {
            if (mAppView.canGoBack())
            {
                mAppView.goBack();
                return true;
            }
        }
        return super.onKeyDown(keyCode, event);
    }
}
  • 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-05-30T12:59:12+00:00Added an answer on May 30, 2026 at 12:59 pm

    With PhoneGap, you could use the “backbutton” event and keep all of your code in JavaScript. See the example in the PhoneGap docs at http://docs.phonegap.com/en/1.4.1/phonegap_events_events.md.html#backbutton

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

Sidebar

Related Questions

I'm having a bit of a trouble here, please help me. I have this
I'm having a little bit of trouble understanding what the problem is here. I
I'm having a bit o' trouble... Here is my mappings.xml file... <?xml version=1.0 encoding=utf-8?>
I'm having a bit of trouble getting a class to import. Here is my
I'm having a bit of trouble with knowing how I can save items from
Having a bit of trouble wrapping my head around Qtimer this morning. Here's the
I am having a bit of trouble understanding this bug. Here is the code:
I'm not sure if this goes here, but I'm having a bit of trouble
I'm having a bit trouble here with creating a map for a browser based
I'm doing a proof of concept thing here and having a bit more trouble

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.