Thursday, December 12, 2013

Re: [android-developers] Displaying Google Map Android API V2 in fragment

Hi Harri,

I have try to write executePendingTransactions() line in my code, but in both cases not getting success :(

in onResume method of CustomFragment Class.
App get Crashed with exception android recursive entry to execute pending transactions.

My Code is as follows:
fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.add(R.id.mapImage, mapFragment);
fragmentTransaction.show(mapFragment);
fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
fragmentTransaction.commit();

//when adding pending transaction line here
fragmentManager.executePendingTransactions();
Throws exception mapFragment view with id not found.

Where, I implement this fragmentManager.executePendingTransactions()?



On Wed, Dec 11, 2013 at 11:47 PM, Harri Smått <harism@gmail.com> wrote:
You should keep following in mind (in regard to your original SO code snippet);

1. Once you add the fragment containing map, and call commit(), the fragment IS NOT added right away. See FragmentManager.executePendingTransactions() for executing the commit() asap.

2. If you still cannot get the proper non null Map reference, try doing it on Fragment.onResume() instead. I believe this is the final chance to get the map object without using a handler..

H

On 11 Dec 2013, at 12:24, surabhi jain <surabhi17.jain@gmail.com> wrote:

Hi,
Thanks for the reply,I have do that but still I am getting same issue.

I have use Handler for getting google map value, code as on below link
http://stackoverflow.com/questions/19219255/supportmapfragment-getmap-returns-null

Scenario is as follows:
I am displaying map in fragment inside view pager,with detail fragment,for map I have created fragment dynamically. I am using single activity so each screen is represented by a Fragment. NewsDetailsFragment includes a ViewPager (map).

When I navigate to the NewsDetailsFragment initially, the map is loaded, now if I load a new instance of the NewsDetailsFragment like on scrolling pager I am displaying my next record. The ViewPager in the 2nd NewsDetailsFragment wont display the map. In LogCat,Log shows that everything works fine, map is displaying and markers get set. But on place of map showing black screen.

Is there any way to get google map value without using Handler in Fragment?


On Wed, Dec 11, 2013 at 4:34 PM, VenomVendor™ <yoganandh2003@gmail.com> wrote:
Have you solved it, if not.
1. Null the Map.
2. Destroy the fragment overriding in onDestroy method.

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Thanks & Regards
Surabhi Jain

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Thanks & Regards
Surabhi Jain

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate