Android Question InputList disappears

positrom2

Active Member
Licensed User
Longtime User
An app working correctly on an older 7" tablet (Android 3.2.1) does not work on a Galaxy SII with Android 4.1.2 and smaller screen size. On the tablet the paired devices can be selected as usual from the popup-screen showing the paired devices, using inputlist (the code below was taken from the BluetoothAdmin tutorial).
B4X:
Sub Verbinden
    Dim PairedDevices As Map
    PairedDevices = blauerZahnDaten.GetPairedDevices
    Dim GeraeteListe As List
    GeraeteListe.Initialize
    For i = 0 To PairedDevices.Size - 1
        GeraeteListe.Add(PairedDevices.GetKeyAt(i))
    Next
    Dim res As Int
    res = InputList(GeraeteListe, "Bitte Gerät wählen", 2) 'show list with paired devices
    If res <> DialogResponse.CANCEL Then
        blauerZahnDaten.Connect(PairedDevices.Get(GeraeteListe.Get(res))) 'convert the name to mac address
    End If
End Sub
On the Galaxy SII the popupscreen shows up only very shortly and disappears without offering the possibility to select an item.
The nucleus of the problem might not be in the different Android versions nor screen sizes since I have another application using the same bluetooth setup which is working correctly on the Galaxy.
So my question is: In order to see the popup menu generated by Inputlist, are there any precautions to be taken considerering the screen layout? If other view are covering the screen, how to get the Input-list screen to the foreground?
 

positrom2

Active Member
Licensed User
Longtime User
I made a minimal example showing the problem:
The Bluetooth-Devices Inputlist is shown persistently in Android 3.2.1 but in Android 4.1.2 it closes immediately. The last log line reads:
** Activity (main) Pause, UserClosed = false **
I hope someone can point to a cure.
 

Attachments

  • BT_Inputlist_Test.zip
    6.5 KB · Views: 285
Upvote 0

positrom2

Active Member
Licensed User
Longtime User
I tested it on Android 4.4.2 and the dialog does show. What causes your activity to be paused?
When single-stepping on the Android 4.1.2 device the program closes when executing the line
B4X:
res = InputList(GeraeteListe, "Bitte Gerät wählen", -1) 'show list with paired devices
after a hard to see pop-up of the screen showing the paired devices.
So I assume the problem must be in the compiled code (I am with B4A 3.2).
Quite interestingly, the original long program runs as expected on the Android 4.1.2 (showing the BT-devices pop-up screen). I enclose it here. From that long program I had copied the BT-relevant lines to the short test program posted above which then does not run on 4.1.2 device.
 

Attachments

  • Largeprogram.zip
    30.1 KB · Views: 271
Upvote 0

positrom2

Active Member
Licensed User
Longtime User
I had inserted a log to print 1234 above the line "res=inputlist(...) to identify what might be of interest.
The log lines thereafter:
1234
Get MotionRecognitionManager
ssp status : false
Failure getting entry for 0x010802c0 (t=7 e=704) in package 0 (error -75)
GC_CONCURRENT freed 503K, 18% free 9640K/11655K, paused 15ms+1ms, total 38ms
WAIT_FOR_CONCURRENT_GC blocked 7ms
PhoneWindowManager: focusChangedLw
** Activity (main) Pause, UserClosed = false **
VM exiting with result code 0, cleanup skipped.
setHidden false
channel ~ Consumer closed input channel or an error occurred. events=0x9
channel ~ Channel is unrecoverably broken and will be disposed!
PhoneWindowManager: focusChangedLw
Process b4a.example (pid 12271) (adj 0) has died.
Attempted to unregister already unregistered input channel
id=580 Removed nain idx=2 MapSz=3
id=580 Removed nain idx=-2 MapSz=3
setHidden false
PhoneWindowManager: focusChangedLw
setHidden false
mInputFocus is not null.
mInputFocus is not null.
id=582(5) createSurf 0x40fc2214 (480x800),1 flag=0, Mauncher
PhoneWindowManager: focusChangedLw
setSystemUiVisibility(0x0)
manageDisableList what=0x0 pkg=WindowManager.LayoutParams
rotationForOrientationLw(orient=5, last=0); user=0 mLidState=-1 mDockMode=0 mHdmiPlugged=false mAccelerometerDefault=false sensorRotation=-1
setHidden false
Send intent for dismiss clipboard dialog inside hideCurrentInputLocked() !
Got RemoteException sending setActive(false) notification to pid 12271 uid 10169
setHidden false
setHidden false
Rebuild removed 2 windows but added 1
id=581 Removed nain idx=3 MapSz=3
id=581 Removed nain idx=-2 MapSz=3
onResume, Launcher: 1100255368
Current app token list:
Final window list:
GC_CONCURRENT freed 487K, 18% free 9660K/11655K, paused 16ms+2ms, total 54ms
....
 
Upvote 0

positrom2

Active Member
Licensed User
Longtime User
Remove the ExitApplication call in Activity_Pause.
That was the cure. Thank you very much. I had stopped working on an application to be given to others because of this problem.
Could you explain for understanding why removing that statement apparently is only needed in Android 4.1.2 but not in some other Android versions like Android 4.4.2 as you had reported (or 3.2.1 as in the older tablet)?
 
Upvote 0

positrom2

Active Member
Licensed User
Longtime User
Update:
Tried again today... Apparently it worked once and no more on the Android 4.1.2 phone.
Connection from PC to the phone was via adb which had been installed by a recent Kies installation.
But, Using the B4A-Bridge the BT-connection (pop-up-menu) worked as it should (and so far apparently repeatedly).
Since installing via USB requires no user interaction one would prefer that instead of the B4A-bridge.
Is there any suggestion what might go wrong with the adb?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Since installing via USB requires no user interaction one would prefer that instead of the B4A-bridge.
Note that if you are using rapid debug mode then no user interaction is required in most cases as well.

ADB shouldn't affect the program behavior. Something on your device causes the activity to be paused. Maybe it has something to do with Kies.
 
Upvote 0

ValDog

Active Member
Licensed User
Longtime User
I too am seeing a similar problem. I am running Android 4.4.2 on a Nexus 7.

I have tried making a call to InputList from Activity_Create as well as Activity_Resume. In both cases the input list is displayed in Rapid Debug mode, but using Legacy Debug or Release mode I never see the input list - even though I know the code is called. The program just blows thru the code without responding to the InputList call. Any ideas?
 
Upvote 0

ValDog

Active Member
Licensed User
Longtime User
Let me clarify that presently I am not calling InputList directly from Activity_Create, but rather from a Sub that is called from Activity_Create - if fact, from a Sub from a Sub - relevant code is as follows:

Sub Activity_Create(FirstTime As Boolean)
....
....
If FirstTime Then btnConnect_Click
End Sub 'Activity_Create

Sub btnConnect_Click
'BLUETOOTH - get it going
Serial1.Initialize("Serial1")
If Serial1.IsEnabled = False Then
Msgbox("Please enable Bluetooth before attempting to connect.", "")
Return
End If

BT_Connect
End Sub 'btnConnect_Click

Sub BT_Connect
....
....
Dim res As Int
res = InputList(lst, "Choose device", -1) 'show list with paired devices

If res <> DialogResponse.CANCEL Then
sMacAddress = PairedDevices.Get(lst.Get(res)) 'convert the name to mac address
sFriendlyName = PairedDevices.GetKeyAt(res)
StartService(BTSerial)
End If
End Sub 'BT_Connect
 
Upvote 0

ValDog

Active Member
Licensed User
Longtime User
No, the InputList seems to work correctly when I call it from Activity_Resume or Activity_Create in a new project.


The problem seems to occur with the btnConnect_Click call being made from Activity_Create. If I just click the Connect button to initiate the btnConnect_Click call it works just fine.
 
Last edited:
Upvote 0
Top