Android Question Two activities

Ajay Kakar

Member
Licensed User
Longtime User
Hi Erel,

Again facing a weird situation. I have two activities. Main and Replypost.

In the main activity a Button click takes me to Replypost. The code is very simple

Sub Button1_Click
If musername <> " " Then
mthread = mthread1
StartActivity("replypost")
Else
StartActivity("noposts")
End If

End Sub

This works fine and takes me to "Replypost". In this activity I get some input and the user hits a button to confirm and I am sending control back to the "Main" activity with startactivity("main")

In main I have the following code in the activity resume sub. The code is as follows

Sub Activity_Resume
Ifreplypost.mlastpostdata.Length > 0Then

Label11.Text = replypost.mlastpostdata

replypost.mlastpostdata = ""



EndIf



End Sub

Sub Activity_Resume

Ifreplypost.mlastpostdata.Length > 0Then

Label11.Text = replypost.mlastpostdata

replypost.mlastpostdata = ""



EndIf



End Sub
 

Ajay Kakar

Member
Licensed User
Longtime User
Hi Erel,

Again facing a weird situation. I have two activities. Main and Replypost.

In the main activity a Button click takes me to Replypost. The code is very simple

Sub Button1_Click
If musername <> " " Then
mthread = mthread1
StartActivity("replypost")
Else
StartActivity("noposts")
End If

End Sub

This works fine and takes me to "Replypost". In this activity I get some input and the user hits a button to confirm and I am sending control back to the "Main" activity with startactivity("main")

In main I have the following code in the activity resume sub. The code is as follows

Sub Activity_Resume
If replypost.mlastpostdata.Length > 0Then
Label11.Text = replypost.mlastpostdata
replypost.mlastpostdata = ""
end if

end sub

Now what actually happens is that when I press the Button in activity Replypost which has startactivity("Main") the control does go back to activity "main" and the label11 value actually changes and I can see the "Main" screen very briefly and then control passes back to the "replypost".

Can you tell me if I have missed out something ??

Ajay

PS: Sorry about the previous Email which got truncated.
 
Upvote 0

Ajay Kakar

Member
Licensed User
Longtime User
Ahh ok. Thanks Klaus. In future I shall do it. Today morning I just resolved the problem. I was calling the "Startactivity(main)" as the last line in the activity_create module of the second activity called "Replypost". I moved the startactivity(main) line to the end of the sub module of the button click and it resolved my problem.

Thanks a ton for the post.

Ajay
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…