android - Getting the fragment from the current activity -


hey guys have fragment

@override public view oncreateview(layoutinflater inflater, viewgroup container,                          bundle savedinstancestate) {     // inflate layout fragment     return inflater.inflate(r.layout.recordings, container, false); } 

here layout

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/recordinglayout"> 

how fragment object without adding activity? or add something, instance button fragment's layout activity class?

an activity cannot reference fragment has not been instantiated somehow. can instantiate fragment via fragment tag in xml, or create 1 programmatically in java.

i suggest take close @ documentation on creating (and referencing) fragments :)


Comments

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -