Re: [android-developers] Re: How to dismiss nested dialogfragment correctly after rotation?

2013-09-15 Thread Hand Green
Thanks for pointing out the mistakes. The whole code is too long to post and maintain readability so I just put some snippet. The MyAsyncTask having a constructor named GetTokenAsyncTask is a typo, the constructor should named MyAsyncTask. As for ProgressFragment, I use its toString() method to

Re: [android-developers] Re: How to dismiss nested dialogfragment correctly after rotation?

2013-09-15 Thread Hand Green
Thank you a lot! Just setting setRetainInstance(true) in DialogFragment is not enough. The dialog just disappears after rotation. I happen to find a thread: http://stackoverflow.com/questions/8235080/fragments-dialogfragment-and-screen-rotation In addition to setRetainInstance(true), we should

Re: [android-developers] Re: LoaderCallbacks.OnLoadFinished called twice in Fragments

2013-08-28 Thread Hand Green
Putting initLoader in onCreate() causes onLoadFinished() be called twice. There is also another thread http://stackoverflow.com/questions/11293441/android-loadercallbacks-onloadfinished-called-twice. It suggest put initLoader in onCreate() in onResume(). It works but I do not know why.

Re: [android-developers] android action bar background

2013-08-25 Thread Hand Green
Thank you. 2013/8/24 TreKing treking...@gmail.com On Fri, Aug 23, 2013 at 9:39 AM, Greenhand cooperateonl...@gmail.comwrote: Is there a way I can control the background scale method (i.e. centerCrop) and see the ActionBar title? Not sure, but I'd try this:

Re: [android-developers] Re: Add a contact via ContentProvider programmatically

2013-08-20 Thread Hand Green
You are right! Thank you a lot! 2013/8/20 Nobu Games dev.nobu.ga...@gmail.com I'm not completely sure but I think you need to create separate inserts for the name and the phone number. So make a separate insert for the phone number and don't forget to set the correct mime type for that.

Re: [android-developers] Re: asynctask vs. FragmentRetainInstance.java in API demo

2013-02-07 Thread Hand Green
Thank you. It is very useful. 2013/2/6 Streets Of Boston flyingdutc...@gmail.com Instead of Threads or AsyncTasks that do the background work getting the data from the server, use Loader (AsyncLoader). You can use the LoaderManager to initially load them and also to restart them. Restarting

Re: [android-developers] Re: asynctask vs. FragmentRetainInstance.java in API demo

2013-02-05 Thread Hand Green
As for .. it is unnecessary for a worker fragment to start a asynctask ..., let me put it in another way. Yes, I agree a fragment without UI is not a worker thread. Why I said .. it is unnecessary for a worker fragment to start a asynctask ... was about the FragmentRetainInstance.java. It does not

Re: [android-developers] Re: asynctask vs. FragmentRetainInstance.java in API demo

2013-02-01 Thread Hand Green
Thank you for your response. If I use a fragment as a worker thread, I will adapt the pattern in FragmentRetainInstance.java. Because it is unnecessary for a worker fragment to start a asynctask, the worker thread can do the task directly by using java.lang.Thread. However, I still do not

Re: [android-developers] Re: android imageview stretch to background height and keep ratio

2013-01-26 Thread Hand Green
I use dp. As far as I know, although I use dp to specify the height, it still cannot resize dynamically according to the width. 2013/1/26 skink psk...@gmail.com Greenhand wrote: To Piren: Thank you. Assigning a specific height to the parent works. The drawback is doing so is a little like

Re: [android-developers] Re: android imageview stretch to background height and keep ratio

2013-01-26 Thread Hand Green
I got it. Thank you very much! 2013/1/26 lbendlin l...@bendlin.us Keep track of the banner height elsewhere (at the point where it gets measured and rendered), and then use that measurement to specify the image height , and then through the aspect ratio, calculate the image width and the

Re: [android-developers] Re: android imageview stretch to background height and keep ratio

2013-01-24 Thread Hand Green
Because if I changed the two inner image views to match_parent, they will expand the background imageview and its parent (RelativeLayout). It did not work. What I would like to do is let the inner imageviews resized automatically to exactly match the background. If it is smaller, it will stretch