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

Python Pandas join aggregated tables -

java - Static nested class instance -

process - Python What is the difference between a Pool of worker processes and just running multiple Processes? -