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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:11:11+00:00 2026-05-25T10:11:11+00:00

I m Using WebView in AlertDialog to authenticate user to twitter. but When i

  • 0

I m Using WebView in AlertDialog to authenticate user to twitter.
but When i click on field in webview ,android keyboard doesnt open.
here is my code that shows how i added webview in alert dialog.
i implicitly call android keyboard but it open keyboard behind alert dialog.

here is my code.

public static void webViewDialog(final String authorizationURL, final int type)
{

    final boolean correctPin;
    System.out.println("In webViewDialog");
    container = new LinearLayout(context);
    container.setOrientation(LinearLayout.VERTICAL);

    container.setMinimumWidth(200);
    container.setMinimumHeight(320); 

    webView = new WebView(context);
    webView.setMinimumWidth(200);
    webView.requestFocusFromTouch();
    webView.setMinimumHeight(380);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.setWebViewClient(new TwitterWebViewClient());
    webView.loadUrl(authorizationURL);
    webView.setBackgroundColor(0xFFbbd7e9);
    container.addView(webView);

    Builder webDialog = new AlertDialog.Builder(context);

    webDialog.setView(container).setTitle("Twitter Login")
            .setPositiveButton("Ok", new DialogInterface.OnClickListener()
        {

                @Override
                public void onClick(DialogInterface dialog, int which) 
                {

                    if (type == 0) 
                    {
                          twitterPinCodeDialog();
                        dialog.dismiss();

                    }
                }
        }).show();
    showVirtualKeyboard();

}
public static void showVirtualKeyboard()
{
    Timer timer = new Timer();
    timer.schedule(new TimerTask()
    {

         @Override
         public void run()
         {
              InputMethodManager m = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);

              if(m != null)
              {
                // m.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
                m.toggleSoftInput(0, InputMethodManager.SHOW_IMPLICIT);
              } 
         }

    }, 100);  
}
  • 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-25T10:11:11+00:00Added an answer on May 25, 2026 at 10:11 am

    Here is my solution to this problem:

    Put a dummy edit text, and set it’s visibility to GONE, and add it to a containing LinearLayout, after adding the WebView to the layout.

    Example:

    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    
    LinearLayout wrapper = new LinearLayout(this);
    WebView webView = new WebView(this);
    EditText keyboardHack = new EditText(this);
    
    keyboardHack.setVisibility(View.GONE);
    
    webView.loadUrl(url);
    
    wrapper.setOrientation(LinearLayout.VERTICAL);
    wrapper.addView(webView, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
    wrapper.addView(keyboardHack, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);              
    
    builder.setView(wrapper);
    
    builder.create().show();
    

    Once this is done, everything should work properly, and when you select an item in the WebView, the keyboard appears as expected.

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

Sidebar

Related Questions

I am loading url in android webview using below code webviewShowPost.loadUrl(URL); I want to
I am using webview in Android. But strangely, sometimes even webview canGoBack method returns
I am using webview in android to display images (mainly using google ajax API),
hello i'm using this example http://lexandera.com/2009/01/extracting-html-from-a-webview/ to get the HTML from a webview. But
I am trying to implement facebook like functionality using android webview. It is working
i am using webview in activity and want to use option menu too. but
I used Google chart api to generate the chart using webview in android. Now
trouble loading html file from plist to webView using following code in FAQDetailViewController.m: -
I am displaying a text file that contains html code in a webview using
I'm loading a 3rd party website into my app using WebView. But there is

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.