Monday, June 10, 2013

Dialog/orientation change memory leaks...

Well, today I kept battling a memory leak in my opening screen for Perspective when rotating the phone.  A quick search yielded plenty of references to orientation changes when rotating.  There were quite a few work arounds, but I found a simple one that really made it simple for me so I figured I'd share.

To fix the problem in my PopDialog class that extends a Dialog, I added a

static PopDialog pd=null;  

Then I added this just after the onCreate

  pd=PopDialog.this;
  MainActivity.opened=true;

and finally I added this method

 public void dismissing(){
if(pd.isShowing()){pd.dismiss();}

}

OK, that's the hard part.  Now in my main activity, I referenced it like this

 PopDialog popdialog;
 private static boolean opened=false;

after onCreate in that activity

popdialog=new PopDialog(this);

and finally in the onPause

@Override
protected void onPause() {
super.onPause();
if(opened){ popdialog.dismissing();}


}
I forgot, add this to the button you call the Dialog from because sometimes it doesn't call onCreate.

opened=true;  

This way when rotating, it always has the proper reference to the active dialog and calls to dismiss it destroying it.  I had to update it a bit by adding the opened in there.  This is won't let it call dismiss before the dialog is created.

Monday, June 3, 2013

Search, settings, and power....

I needed some icons for Perspective and these are what I came up with in Fireworks cs6.  The below links are saved so that they should pull up with all layers attached for easy editing or whatever you want to do with them.  If you use them, feel free to download some a54studio apps:)  Added a more holofied version those that want them.







https://docs.google.com/file/d/0B1I8VfqhLQvBb1FHTGozLVkyX2c/edit?usp=sharing

https://docs.google.com/file/d/0B1I8VfqhLQvBYXlMTWZZeW9jMVU/edit?usp=sharing

https://docs.google.com/file/d/0B1I8VfqhLQvBLUV0RGxhUW5DeGM/edit?usp=sharing

https://docs.google.com/file/d/0B1I8VfqhLQvBWVh6X1dqek1nSnM/edit?usp=sharing