Android Question Activity.Finish problem

Douglas Farias

Expert
Licensed User
Longtime User
hi
i m using Activity.Finish
to close my activity named perfil
but this dont close total

when i open again this activity show me
** Activity (perfil) Create, isFirst = false **

why dont close for total?

it give me error because load all layout again and again and again and it crash my app

how can i make to realy close this activity
for when you open again show me
isFirst = true

B4X:
    Sub Activity_Pause (UserClosed As Boolean)
    If UserClosed = True Then
    If camEx.IsInitialized = True Then
    camEx.Release
    End If
    Activity.Finish
    End If
    End Sub
 

Douglas Farias

Expert
Licensed User
Longtime User
my layout have big images need load only one time is a big layout 10 + panels with buttons etc etc
i have problem
Downsampling image due to lack of memory

i try to make

if FirstTime = true
loadmylayout
else

end if

and this give me error label not initialized etc etc

when i remove this
if FirstTime = true

works fine but only 2 or 3 times because load my layout again and again

i need to find a way to realy close my perfil activity

i go show you my app
please log on using facebook

later when you is on your profile page press back key
later log on again
u need make this 3 4 times to show
my app stop work =(

http://clickfight.com.br/result.apk < apk download
 
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime User
nop is not defined in Process_Globals
my bitmaps load in
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("login") <<<< here
10 + panels buttons and imagesviews inside this layout

but is stranged in released mode dont stop my app only in debug

i m trying to make this but not sucess
Activity.RemoveAllViews
Activity.Finish
 
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime User
now my log is diferent
 

Attachments

  • Sem título.png
    Sem título.png
    168.2 KB · Views: 188
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime User
50+ images have images with 500 kb 10 15 25 300 *-* for this i need run layout only one time =(
 
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime User
dont give me error at first time only later
firsth time run app normal no problem
 
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
720 x 1756 = 4.8 MB (uncompressed bitmap in memory)
If you have even 10 of those you might hit the memory limit.
And remember each Android version came with different memory management (so Froyo etc will hardly load 3 of those images)

To make sure your bitmaps are cleared, you need to make sure there are no references to it anymore.
i.e. all imageview.bitmap = null , and the bitmap is not stored in a list or variable anywhere else.

It is a little weird though, while you remove all views, it still comes back, for some reason they are not being cleared.
Which phone/device/android versoin you are running on?
 
Upvote 0
Top