fragment

SupportMapFragment Map is null

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-31 05:29:18
问题 I am using following code to display a map in Xamarin.Android: private SupportMapFragment mapFragment; private GoogleMap map; protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.Main); mapFragment = SupportFragmentManager.FindFragmentByTag ("map") as SupportMapFragment; if (mapFragment == null) { GoogleMapOptions options = new GoogleMapOptions () .InvokeCompassEnabled (true) .InvokeMapType (GoogleMap.MapTypeNone)

Youtube video get stuck while playing in fragment

萝らか妹 提交于 2019-12-31 03:38:06
问题 I am new to Android.I am trying to play youtube video while the fragment loads.That means video should be playing while open the app.When I use this in activity it works(YouTubePlayerView ),but when I use YouTubePlayerSupportFragment video get stuck and not playing properly. this is the code for youtube: YouTubePlayerSupportFragment youTubePlayerFragment = YouTubePlayerSupportFragment.newInstance(); FragmentTransaction transaction =getChildFragmentManager().beginTransaction(); transaction.add

Adding child Fragment to Parent Fragment withing a ViewPager in Android

◇◆丶佛笑我妖孽 提交于 2019-12-31 03:02:10
问题 I'm developing an app that has some tabs,something like this Each tab is a Fragment, and each fragment displays a listview of articles, categories and some other information. What I'm trying to do is to when I tap in an item from the listview in a fragment, open a new Fragment with the full article or more info . I've read that this has to do with nested Fragments, and that I have to use the method getChildFragmentManager() . I am using a ViewPager to display my fragments in the tabs, this is

fragmentDispatchingAndroidInjector while using support fragments

霸气de小男生 提交于 2019-12-31 01:23:06
问题 I'm trying to create a simple dagger 2 application while using support v4 fragments. After I modified my application I got this strange compilation error Error:(35, 8) error: [dagger.android.AndroidInjector.inject(T)] java.util.Map<java.lang.Class<? extends android.support.v4.app.Fragment>,javax.inject.Provider<dagger.android.AndroidInjector.Factory<? extends android.support.v4.app.Fragment>>> cannot be provided without an @Provides-annotated method. java.util.Map<java.lang.Class<? extends

Android Fragment和Activity

℡╲_俬逩灬. 提交于 2019-12-30 14:04:16
Fragment和Activity Fragment和Activity的交互   一个Fragment的实例总是和包含它的Activity直接相关。   fragment可以通过 getActivity() 方法来获得Activity的实例,然后就可以调用一些例如findViewById()之类的方法。   如:    View listView = getActivity() . findViewById (R.id.list);    但是注意调用getActivity()时,fragment必须和activity关联(attached to an activity),否则将会返回一个null。   相似的,activity也可以获得一个fragment的引用,从而调用fragment中的方法。   获得fragment的引用要用 FragmentManager ,之后可以调用 findFragmentById() 或者 findFragmentByTag() .   比如:    ExampleFragment fragment = (ExampleFragment) getFragmentManager().findFragmentById(R.id.example_fragment); 创建事件回调    一些情况下,可能需要fragment和activity共享事件

How to set application fragments to portrait mode only?

瘦欲@ 提交于 2019-12-30 11:14:55
问题 I have an Android app which has a main activity and 3 Fragments which are tabs. I would like the application to remain in portrait mode at all times but I can't seem to get this working. This is what I have tried, as per another stack overflow post, but I'm not sure what I'm doing wrong....does it need to be different if using fragments? <activity android:name="com.tutorial.test.activities.act1" android:label="@string/app_name" android:screenOrientation="portrait" android:configChanges=

Call Activity Method From Fragment

限于喜欢 提交于 2019-12-30 10:34:16
问题 I'm dealing with fragments. I have an Activity and different fragments . Each fragment need the access to a Class(call it X) that allow it to access a database, but, because I have a lot of fragments, I don't want to create a different instance of the Class X in every fragment as I think it will require lots of memory . So how can I do? I wrote something like this (with a getter), but it doesn't work! public class MyActivity { private ClassX classx; ..... public ClassX getClassX() { return

Url fragment and Referer header

自闭症网瘾萝莉.ら 提交于 2019-12-30 08:10:10
问题 Imagine you are on a page whose URL has a fragment (the part after the # ), and click a link to go to another page. Most browsers will send the URL of the original page to the server in the Referer header. What I want to know is whether or not the URL fragment will be included in this or not. I have seen various behaviors in the wild so this might be browser-specific. Does anyone know which browsers do what? And what does the HTTP spec say on this? 回答1: The spec says that Referer can't

Update a TextView in a ViewPager from another Fragment

你说的曾经没有我的故事 提交于 2019-12-30 07:50:08
问题 I am trying to update a TextView in a Fragment clicking on a button on another Fragment. Actually I implemented the callback function to the Activity and it does work, since the Logcat reports that the text in the TextView has been changed. The problem is the Textview shown in the first fragment is not updated to the new value! It's like the Fragment needs to be updated or something... Here's the ActionBarTabsPager activity code: import java.util.ArrayList; import android.app.Activity; import

Android: Adding a simple Fragment

早过忘川 提交于 2019-12-30 06:31:30
问题 I am pretty new to Android Apps, so I hope I can find some help here. I have already searched for my problem in here and found something, but that does not work. I want to add a Fragment to a FrameLayout but it does not work. My goal ist to create a Frame (/Framework?) that is always present and the user can interact with it and inside this Frame in a specific "window" I want to display pages/fragments, five in total, and beeing able to switch the pages/fragments at any time, so I have an