How to detect whether the virtual keyboard is visible or not? SDK 1.5

by Dianne Hackborn » Wed, 29 Apr 2009 12:28:44 GMT


Sponsored Links
 There is no way to discover this, except for indirectly as your UI is
resized to accommodate the IME.






-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Wifi - Unable to scan for networks

Hi, in Wifi module, postAttemptScan is used to retry for the scanning.
Below is the section of code. Here
SCAN_MAX_RETRY is 5, if it retry it for 4 times ( as he is doing
below ), then it will display "Unable to scan Network" and immediately
displays the Scan AP. if it retry it for 5 times, then it will not
display the message and displays the Scan AP.

Whey is this behavior?

mScanRetryCoun = 0;
private void postAttemptScan() {
        //onScanningStarted();

        if (++mScanRetryCount < SCAN_MAX_RETRY) {
            // Just in case, remove previous ones first
            removeFutureScans();
            mHandler.sendEmptyMessageDelayed(MESSAGE_ATTEMPT_SCAN,
SCAN_RETRY_DELAY_MS);
        } else {
            // Show an error once we run out of attempts
            error(R.string.error_scanning);
            onScanningEnded();
        }
    }

Attached log
1> With 5 retry

V/SettingsWifiLayer( 1483): --->postAttemptScan IN
V/SettingsWifiLayer( 1483): --->mScanRetryCount 4
D/wpa_supplicant( 1578): WPA_SUPP: enter into wpa_supplicant_scan
I/wpa_supplicant( 1578): [WPA_SPCNT] wpa_supplicant_scan => enabled=0
wpa_s->scan_req=0
D/wpa_supplicant( 1578): No enabled networks - do not scan
D/wpa_supplicant( 1578): WPA_SUPP: enter into wpa_supplicant_set_state
D/wpa_supplicant( 1578): WPA_SUPP: enter into wpa_supplicant_state_txt
D/wpa_supplicant( 1578): WPA_SUPP: enter into wpa_supplicant_state_txt
D/wpa_supplicant( 1578): State: SCANNING -> INACTIVE
I/wpa_supplicant( 1578): CTRL-EVENT-STATE-CHANGE id=-1 state=1
D/wpa_supplicant( 1578): WPA_SUPP: enter into
wpa_supplicant_ctrl_iface_msg_cb
D/wpa_supplicant( 1578): WPA_SUPP: enter into
wpa_supplicant_ctrl_iface_send
D/wpa_supplicant( 1578): WPA_SUPP: leave from
wpa_supplicant_ctrl_iface_msg_cb
D/wpa_supplicant( 1578): WPA_SUPP: leave from wpa_supplicant_set_state
W/WifiHW  ( 1238): [HAL] wifi_command=AP_SCAN 1
E/WifiHW  ( 1238): [HAL] Not connected to wpa_supplicant - "AP_SCAN 1"
command dropped.
W/WifiHW  ( 1238): [HAL] wifi_command=SCAN
E/WifiHW  ( 1238): [HAL] Not connected to wpa_supplicant - "SCAN"
command dropped.
V/SettingsWifiLayer( 1483): --->postAttemptScan IN
V/SettingsWifiLayer( 1483): --->mScanRetryCount 5
I/WifiMonitor( 1238): WifiMoniotr will launch
WifiNative.conectToSupplicant()
/WifiMonitor( 1232): WifiMoniotr will launch
WifiNative.conectToSupplicant()
E/WifiHW  ( 1232): wifi_connect_to_supplicant

2. with 4 retry

V/SettingsWifiLayer( 1483): --->postAttemptScan IN
/SettingsWifiLayer( 1411): --->mScanRetryCount 4
D/wpa_supplicant( 1507): WPA_SUPP: enter into wpa_supplicant_scan
I/wpa_supplicant( 1507): [WPA_SPCNT] wpa_supplicant_scan => enabled=0
wpa_s->scan_req=0
D/wpa_supplicant( 1507): No enabled networks - do not scan
D/wpa_supplicant( 1507): WPA_SUPP: enter into wpa_supplicant_set_state
D/wpa_supplicant( 1507): WPA_SUPP: enter into wpa_supplicant_state_txt
D/wpa_supplicant( 1507): WPA_SUPP: enter into wpa_supplicant_state_txt
D/wpa_supplicant( 1507): State: SCANNING -> INACTIVE
I/wpa_supplicant( 1507): CTRL-EVENT-STATE-CHANGE id=-1 state=1
D/wpa_supplicant( 1507): WPA_SUPP: enter into
wpa_supplicant_ctrl_iface_msg_cb
D/wpa_supplicant( 1507): WPA_SUPP: enter into
wpa_supplicant_ctrl_iface_send
D/wpa_supplicant( 1507): WPA_SUPP: leave from
wpa_supplicant_ctrl_iface_msg_cb
D/wpa_supplicant( 1507): WPA_SUPP: leave from wpa_supplicant_set_state
W/WifiHW  ( 1232): [HAL] wifi_command=AP_SCAN 1
E/WifiHW  ( 1232): [HAL] Not connected to wpa_supplicant - "AP_SCAN 1"
command dropped.
W/WifiHW  ( 1232): [HAL] wifi_command=SCAN
E/WifiHW  ( 1232): [HAL] Not connected to wpa_supplicant - "SCAN"
command dropped.
V/SettingsWifiLayer( 1411): --->run out of attempts: error
E/SettingsWifiLayer( 1411): Unable to scan for networks


Behavior of both is same, but only thing is displaying of  "Unable to
scan for networks" extra message.

Please let me know why is this difference when scanned for 4 or 5
times.

Regards
Gururaja B O

-- 

2. UncaughtExceptionHandler not called ?

Hello,

i use a ScheduledThreadPoolExecutor combined with a ThreadFactory,
their all combined should
cause an unchaught Exception to be logged so that i can see what
happening if any thread is dying in the ThreadPool:

threadPool = new ScheduledThreadPoolExecutor(poolSize, new
ThreadFactory());


My ThreadFactory, also sets a UncaughtExceptionHandler :

        public Thread newThread(final Runnable r)
        {
                final Thread thread = new Thread(r);
                thread.setUncaughtExceptionHandler(new ThreadLogger());
                final int counter = count.getAndIncrement();
                final String name = threadName + counter;
                thread.setName(threadName + counter);
                if (Logging.isLoggingEnabled())
                {
                        Log.d(LOG_TAG, "Thread created :" + name);
                }
                return thread;
        }


The ThreadLogger :

public final class ThreadLogger implements
Thread.UncaughtExceptionHandler
{
        private final static String LOG_TAG =
ThreadLogger.class.getSimpleName();

        /*
         * (non-Javadoc)
         *
         * @see
         *
java.lang.Thread.UncaughtExceptionHandler#uncaughtException(java.lang
         * .Thread, java.lang.Throwable)
         */
        @Override
        public void uncaughtException(final Thread _thread, final Throwable
_ex)
        {
                Log.e(LOG_TAG, "uncaughtException, Name" + _thread.getName() + "
prio " + _thread.getPriority(), _ex);
        }


But when a RuntimeException is thrown the Handler never get called. Is
this a Bug ?

Best regards,
Jens

-- 

3. Motorola Droid / Milestone projector

4. Why am i getting same values of different JSON date values?

5. DetikInet : Produsen BlackBerry 'Provokasi' Mahasiswa UI

6. widget setting frame

7. listen for changes made in ContactMethod table