Android Question New B4a-Version(7.30) and new problem :(

Status
Not open for further replies.
D

Deleted member 103

Guest
Hi,

I have in a class this Code:
B4X:
Public Sub ShowMessage
    Msgbox2Async(msg.ToString, "Validation-Check","OK","","",Null, False)
    Wait For Msgbox_Result (Result As Int)
End Sub

and in Main this sub:
B4X:
Public Sub Check_AppValidation
'    Log("CheckAppValidation")
    If Not(Starter.IsLicensevalid) Then
        If Not(check.IsApkFromGooglePlay("","")) Then
            check.ShowMessage
            Wait For Msgbox_Result (Result As Int)
            Log("check.ShowMessage")
            If check.RestDelayedDay = 0 Then
                Activity.Finish
            End If
        End If
    End If
End Sub

With B4a 7.01 everything has worked, and now with 7.30 it does not work anymore.
This line "If check.RestDelayedDay" is no longer executed.
 
D

Deleted member 103

Guest
because you duplicate using wait for you must use one time after call msgbox2async to reach it
Is not true!
If I delete "wait for" in "Sub ShowMessage" then the Msgbox is displayed, but the line "If check.RestDelayedDay" is not executed.
If I delete "wait for" in Sub "Check_AppValidation" then no Msgbox is displayed and the app is terminated.
 
Upvote 0

azzam223

Active Member
Licensed User
Longtime User
you have two options the first is put wait for with showmsg sub and return result to second sub

B4X:
Public Sub ShowMessage as resumablesub
Msgbox2Async(msg.ToString, "Validation-Check","OK","","",Null, False)
WaitFor Msgbox_Result (Result As Int)
return result
End Sub
the main activity
B4X:
' Log("CheckAppValidation")
If Not(Starter.IsLicensevalid) Then
If Not(check.IsApkFromGooglePlay("","")) Then
wait for ( check.ShowMessage) Complete(result as int)
Log("check.ShowMessage")
If check.RestDelayedDay = 0
ThenActivity.Finish
EndIf
EndIf
EndIf
End Sub

the second is put the Msgbox2Async sub in the main activity

B4X:
' Log("CheckAppValidation")
If Not(Starter.IsLicensevalid) Then
If Not(check.IsApkFromGooglePlay("","")) Then
Msgbox2Async(msg.ToString, "Validation-Check","OK","","",Null, False)
WaitFor Msgbox_Result (Result As Int)
Log("check.ShowMessage")
If check.RestDelayedDay = 0
ThenActivity.Finish
EndIf
EndIf
EndIf
End Sub

You Can Choose the first or the second the choose is in you hand ;)
 
Last edited:
Upvote 0
D

Deleted member 103

Guest
ok, so could work (did not try yet).
but it has worked in 7.01 everything without problems.

I do not understand why one must always reinvent the wheel. :mad:
 
Upvote 0
D

Deleted member 103

Guest
I think I go back to 7.01 or even to 6.80 back.
B4a with "wait for" prepares me more problems than without. :(
 
Upvote 0

azzam223

Active Member
Licensed User
Longtime User
NO, The B4a With wait for and resumable sub Is excellent If you Read the subject of wait for again maybe you will know how it work

you can use the normal msgbox2 with any problems if you wish
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I think I go back to 7.01 or even to 6.80 back.
I'm not sure why do you write all these rants. Everything that was supported in previous versions is also supported in v7.30. Whether you want to use the async methods or not is your decision.

@azzam223 code is correct. You should use 'wait for' to wait for ShowMessage to complete:
B4X:
Wait For (Check.ShowMessage) Complete(result as int)
 
Upvote 0
D

Deleted member 103

Guest
Everything that was supported in previous versions is also supported in v7.30.
it is not true.
I can reproduce this at any time.

But it does not matter, I will now use the code from @azzam223.

The problem is that since a few versions, no longer without a change to the old source code, can no longer simply recompile.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0
D

Deleted member 103

Guest
B4X is notorious for notbreaking existing code between versions. Maybe something else is going on.
I know that too. I use B4a since version 1.0. :cool:
 
Upvote 0

AnandGupta

Expert
Licensed User
Longtime User
Whenever one moves ahead he/she has to leave something behind in order to move smoothly.

Remember the hue and cry when Win 8 came. And also when Win 95 came. Both were radically different then their previous avatars. Remember Jelly Bean and now Oreo ! Android is evolving.

B4A has to move with time.

So if you get problem in B4A 7.30, just ask and you will get solution here, in our Forum.

Regards,

Anand
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Whenever one moves ahead he/she has to leave something behind in order to move smoothly.
This is not the case here.
B4A v7.30, like all other versions, is backwards compatible. There was a documented bug in v7.01 that was fixed in v7.30. The code in the first post worked because of that bug.
Backwards compatibility is a very important aspect in programming languages.
 
Last edited:
Upvote 0

AnandGupta

Expert
Licensed User
Longtime User
This is not the case here.
B4A v7.30, like all other versions, is backwards compatible. There was a documented bug in v7.01 that was fixed in v7.30. The code in the first post worked because of that bug.
Backwards compatibility is a very important aspect in programming languages.

Yes I agree.
By "leave something behind in order to move smoothly" I meant bug fixes too. The problem is if someone inadvertently used the "bug" logic/code in many places in his/her many application, he/she becomes alarmed getting error messages by simply compiling the existing "perfect" code.

So I suggested to find and fix those codes which were using the "bug" logic instead of getting alarmed. I have followed this rule in all my programming languages I use, even consulting the developer sometimes and finding a workaround.

Regards,

Anand
 
Upvote 0
D

Deleted member 103

Guest
Yes I agree.
By "leave something behind in order to move smoothly" I meant bug fixes too. The problem is if someone inadvertently used the "bug" logic/code in many places in his/her many application, he/she becomes alarmed getting error messages by simply compiling the existing "perfect" code.

So I suggested to find and fix those codes which were using the "bug" logic instead of getting alarmed. I have followed this rule in all my programming languages I use, even consulting the developer sometimes and finding a workaround.

Regards,

Anand

I do not want to start a discussion here, but I have to say one thing.

Before I finish an app, I test everything and if there is no problem, then I do it publish.

Then it should be understandable that one is excited when one opens the source code with a new B4a version and complies and there are errors which were not before there were. :cool:

I know now that it only worked because there were errors in B4a, but how should I have known?
 
Upvote 0

azzam223

Active Member
Licensed User
Longtime User
you must know the changes and the improved in the new version maybe there are new sub that is best functions rather the previous version like Msgbox in previous version we use the msgbox to show message and wait the response from user ,now the new version add new sub and use wait for to wait answer also all subs in previous versions is in the new version maybe you see error but not big error maybe there update to the sub you use in previous version

So You must know the changes in new version and See if there any subs that is improved in new version
 
Upvote 0
D

Deleted member 103

Guest
So You must know the changes in new version and See if there any subs that is improved in new version
Why should I change something that has worked well? :)

You also know the phrase "never change a running system". ;)
 
Upvote 0
Status
Not open for further replies.
Top