B++ wrote:
> The "View" instance currently provides a way to retrieve the saved
> state using the methods below, but there doesn't seem a way to
> retrieve the view's saved state in the constructor, or
> onFinishInflate. The custom view is constructed via XML, so I cannot
> pass the saved bundle from the Activity to the View's constructor.
> 
> Relevant methods:
> - protected Parcelable onSaveInstanceState()  and
> - protected void onRestoreInstanceState(Parcelable state)
> 
> I need this because I make an asynchronous network request in a custom
> view constructor

Ick.

> and if there is a configuration (orientation)
> change, the custom view is getting reconstructed, and the request is
> getting performed again. I want to intercept the second request in the
> constructor. I can do this in the onRestoreInstanceState, but I need
> to handle this in the constructor.
> 
> It would be nice if there was a method such as getSavedState so that
> the decision can be made in a constructor or onFinishInflate instead
> of waiting for the onRestoreInstanceState trigger.
>
> Any idea?

Don't do an asynchronous network request from a View. I realize that
Android isn't necessarily the ideal MVC platform, but I really recommend
you separate your concerns more than that.

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

_Android Programming Tutorials_ Version 1.0 Available!

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

Reply via email to