2017년 7월 15일 토요일

How to avoid crashing from large images


When I switch between full-screen size images the app crashes.

I want to keep the programming the same but manipulate the image files and am not sure how I should edit them.

For example should I compress the images, resize the images, lower the resolution to make the app work etc.

My screen resolution for my Nexus 5x phone is 1920 x 1080 (423 ppi) with a screen size of 5.2 inches (132.08mm).

Thank you in advance,

--
Using Images with App Inventor 

It does not look like you have used the forums yet, as a search using the search box above would have returned several threads about this topic.


Advice: Before posting, it's a good idea to search in this forum. Many others have likely run into problems similar to yours. How to search see screenshot.
See also the  Top 5 Tips: How to learn App Inventor

     
-- 
First, if you have not already done so, please read 
⦁ Using Images with App Inventor


Compression of the images is not going to help.  Resizing the images is your best bet.  Lowering the resolution will make a smaller file size and it might help.
None of your images should be larger than the  screen resolution for my Nexus 5x phone is 1920 x 1080 (423 ppi) with a screen size of 5.2 inches (132.08mm). If you 
are only developing for yourself.  The idea is to keep the images 'right sized'.

"When I switch between full-screen size images the app crashes" might be fixed but there could be other programming issues that could cause the problem...switching screens, using a Clock etc.

--
Thanks for the help guys.

I'm just wondering, if I have for example a HorizontalArrangement that is set to 'not visible' but have a high res image inside the HorizontalArrangement that is 'visible' will this still use memory?
Obviously the image can't be seen but should I still set it to 'not visible' also?

--
it still will use memory even if it's not visible
you should reduce the size as described in the document, see again the link

-- 
It’s not necessary to have images as large as your screen size of your phone 1080*1920 if the quality is good,
if you use do it in blocks of screen.height and screen.width you will see the screen size you can make use of for your images.

Other things to take into account is StatusBar, TitleBar and NavigationBar if they are visible or not.
StatusBar, TitleBar and NavigationBar visible = 633dp height
StatusBar  and NavigationBar visible = 658dp height
NavigationBar visible = 683dp height
Non visible = 731dp height





-- 
Thanks Taifun and Boban,

Yes, I have reduced the image sizes to match my phones screen but am still using too much memory.


"it still will use memory even if it's not visible"

Does this mean I need to set the images to 'nothing' when not in use or can I make the images not visible?

-- 
If your image is stored within the app, it uses memory...period.  Be aware, Android apps compete for the device's memory.  If another app is open, it is sharing memory with your Project.
If your horizontal arrangement is  false (invisible), you do not also have to make the Image control false..

You just said " have reduced the image sizes to match my phones screen but am still using too much memory."   Does that mean your app still crashes when you switch between full sized images?   remember where I said "there could be other programming issues that could cause the problem...switching screens, using a Clock etc."   Show some blocks or an aia to get more advice. How large is your Project aia?    When you switch images, are you playing sounds or changing screens or processing other blocks?

-- 

댓글 없음:

댓글 쓰기