[android-developers] Re: Force Close Question

2011-02-02 Thread Scott Deutsch
Wished Android made a class that it does not touch until the app is
totally dead...so when you tap back on the app, it will start back
from the beginning.

Oh well. I will just redesign to be better then.

Thanks group.

On Feb 2, 4:09 am, Mark Murphy  wrote:
> If the process is being killed, the Application is gone too.
>
>
>
>
>
>
>
>
>
> On Tue, Feb 1, 2011 at 9:38 PM, bruce  wrote:
> > If your process is killed, all the activities are killed so its not
> > like the globals are released and you still have activities running
> > causing a force close.  Sounds like you need to extend Application()
> > and use that to contain your static globals.  Not that its a good
> > practice and likely you have settings and other items that need to use
> > a database, etc. but it is available.
>
> > Seehttp://developer.android.com/reference/android/app/Application.html.
>
> > Cheers,
> > Bruce
>
> > --
> >http://mtterra.com/quicklogger
>
> > On Feb 1, 5:31 pm, Scott Deutsch  wrote:
> >> Thats what I fearedok I will redesign it to make it work.
>
> >> Thanks a bunch.
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Android Training in London:http://bit.ly/smand1andhttp://bit.ly/smand2

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: Force Close Question

2011-02-02 Thread Mark Murphy
If the process is being killed, the Application is gone too.

On Tue, Feb 1, 2011 at 9:38 PM, bruce  wrote:
> If your process is killed, all the activities are killed so its not
> like the globals are released and you still have activities running
> causing a force close.  Sounds like you need to extend Application()
> and use that to contain your static globals.  Not that its a good
> practice and likely you have settings and other items that need to use
> a database, etc. but it is available.
>
> See http://developer.android.com/reference/android/app/Application.html.
>
> Cheers,
> Bruce
>
> --
> http://mtterra.com/quicklogger
>
>
> On Feb 1, 5:31 pm, Scott Deutsch  wrote:
>> Thats what I fearedok I will redesign it to make it work.
>>
>> Thanks a bunch.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in London: http://bit.ly/smand1 and http://bit.ly/smand2

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Force Close Question

2011-02-01 Thread William Ferguson
Sorry, yes .. you need to declare it in the manifest too.

See android:name in
http://developer.android.com/guide/topics/manifest/application-element.html

You know Google is a great resources for these types of questions ..


On Feb 2, 3:05 pm, Scott Deutsch  wrote:
> Anything special you have to do in the Android manifest to say that
> you over wrote it?
>
> On Feb 1, 9:00 pm, William Ferguson 
> wrote:
>
> > Extending Application is trivial:
>
> > public final MyApplication extends Application {
> >   private Object somethingINeedToCache
>
> > }
>
> > On Feb 2, 12:56 pm, Scott Deutsch  wrote:
>
> > > Sounds interesting. I should give that a go and see if that fixes my 
> > > problem
> > > before I totally redesign part of my appi really don't want to do 
> > > that.
>
> > > Anyways..any good tutorials on extending Application?
>
> > > Thanks.
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Force Close Question

2011-02-01 Thread Scott Deutsch
Anything special you have to do in the Android manifest to say that
you over wrote it?

On Feb 1, 9:00 pm, William Ferguson 
wrote:
> Extending Application is trivial:
>
> public final MyApplication extends Application {
>   private Object somethingINeedToCache
>
> }
>
> On Feb 2, 12:56 pm, Scott Deutsch  wrote:
>
>
>
>
>
>
>
> > Sounds interesting. I should give that a go and see if that fixes my problem
> > before I totally redesign part of my appi really don't want to do that.
>
> > Anyways..any good tutorials on extending Application?
>
> > Thanks.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Force Close Question

2011-02-01 Thread William Ferguson
Extending Application is trivial:

public final MyApplication extends Application {
  private Object somethingINeedToCache
}



On Feb 2, 12:56 pm, Scott Deutsch  wrote:
> Sounds interesting. I should give that a go and see if that fixes my problem
> before I totally redesign part of my appi really don't want to do that.
>
> Anyways..any good tutorials on extending Application?
>
> Thanks.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Force Close Question

2011-02-01 Thread Scott Deutsch
Sounds interesting. I should give that a go and see if that fixes my problem 
before I totally redesign part of my appi really don't want to do that.

Anyways..any good tutorials on extending Application?

Thanks.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Force Close Question

2011-02-01 Thread bruce
If your process is killed, all the activities are killed so its not
like the globals are released and you still have activities running
causing a force close.  Sounds like you need to extend Application()
and use that to contain your static globals.  Not that its a good
practice and likely you have settings and other items that need to use
a database, etc. but it is available.

See http://developer.android.com/reference/android/app/Application.html.

Cheers,
Bruce

--
http://mtterra.com/quicklogger


On Feb 1, 5:31 pm, Scott Deutsch  wrote:
> Thats what I fearedok I will redesign it to make it work.
>
> Thanks a bunch.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: Force Close Question

2011-02-01 Thread Scott Deutsch
Thats what I fearedok I will redesign it to make it work.

Thanks a bunch.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Force Close Question

2011-02-01 Thread Mark Murphy
On Tue, Feb 1, 2011 at 8:16 PM, Scott Deutsch  wrote:
> Ok, so I debugged it and my thoughts were correct. It is releasing memory
> from the globals class.

More accurately, it is terminating your process.

> How can I tell it not to release memory from the
> globals class?

You don't.

> So...if anything in th global class dies...my program dies since different
> activities relys on different things and each activity can change something
> in the global so I can't just re-init everything.

Use a database. Or a file. Your application process will not keep
running forever; anything that needs to persist needs to be persisted.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in Atlanta: http://bignerdranch.com/classes/android

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Force Close Question

2011-02-01 Thread Scott Deutsch
Hello Group,

Ok, so I debugged it and my thoughts were correct. It is releasing memory 
from the globals class. How can I tell it not to release memory from the 
globals class? Everything in the globals class is static. Oh, the globals 
class is not an activity.

So...if anything in th global class dies...my program dies since different 
activities relys on different things and each activity can change something 
in the global so I can't just re-init everything.

What is the best way to handle this?

Thanks.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Force Close Question

2011-02-01 Thread Scott Deutsch
Thanks for your replyI was looking at that article before.

Now...my app has lots of activities. The first activity loads up global 
values and so on and shows the intro screen. Now, I am thinking that some 
how it is freeing up the global values and that is what is killing the app. 

Thanks,

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Force Close Question

2011-02-01 Thread Hari Edo

Something else is causing your Force Close.  Read the exception
report in LogCat and dig into the actual cause.

Read up on the Activity lifecycle, in particular the bubble
that reads "Other applications need memory":

http://developer.android.com/reference/android/app/Activity.html

The Android OS won't even try to return to your app if
it reaped it for memory.  It will just restart it.  There
is no way that it reaps some part of the app state
irretrievably, but leaves the process going.

If the system is low on memory, your app may receive an
*opportunity* to shed some of its state data at the app's
discretion.  If your app does honor this *request*, then
the system may have regained enough memory to allow the
user to run some other heavy task in the foreground.  The
current activity also got an earlier courtesy notice when
your activity was no longer active, giving an opportunity
to save the state away.  If your app does not honor these
requests, or cannot free up enough memory, the then the
system reserves the right to completely kill the whole
process as a whole.  If that happens, your next startup
will surely be as a brand new process, and your activity
will be handed whatever you chose to save away earlier.

You *can* flag your app to "start at the initial activity"
every time the app is suspended and resumed, but that is
completely separate from your impression that Android
frees up memory without any notice or control over its
own state.

On Feb 1, 7:18 pm, Scott Deutsch  wrote:
> Hello Group,
>
> How can I deal with when the user hits the home button when in my app and
> then doesnt go back to it for a while and then they hold home button to go
> back to my app and then the force close appears since all the memory has
> been freed because how the OS is designed.
>
> Is there a way instead of resuming the app that has freed memory and will
> break instantly...just launch it brand new?
>
> Is there a setting in the Android Manifest to force start brand new if freed
> memory?
>
> Thanks group.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en