Android TextView setText results in empty text -


I try to set the text of a text message programmatically within one piece. The SIC code for the class:

  public abstract class AbstractFragment extends Piece {@Override protected void onActivityResult (integer requestCode, integer resultCode, the final effect data) {this.setFileName (); } Protected abstract zero settingFileName (); } Public class ImplementingFragment AbstractFragment {@Override public view onCreateView (LayoutInflater inflater, ViewGroup container, bundle savedInstanceState) {piece View = inflater.inflate (R.layout.fragment_layout, extends container, false); Return piece; } @ Override Secure Zero SetFilename () {string filename = "Test.txt"; TextView TextView = ((TextView) getActivity (). FindViewById (R.id.text_file_name)); TextView.setText (file name); }}   

The layout is as follows:

  & lt; linearLayout xmlns: android = "http://schemas.android.com/apk/res / Android" xmlns: device = "http://schemas.android.com/tools" Android: layout_width = "fill_parent" Android: layout_height = "Fill_parent" Android: Orientation = "vertical" Android: paddingBottom = "@ Dimen / activity_vertical_margin" Android: paddingLeft = "@ Dimen / activity_horizontal_margin" Android: paddingRight = "@ Dimen / activity_horizontal_margin" Android: paddingTop = "@ Dimen / activity_vertical_margin" & Gt; & Lt; Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" android: text = "@ string / text_pdf_filename" android: textAppearance = "Android: attr / textAppearanceMedium" / & gt; TextView: Android: id = "@ + id / text_pdf_filename_title" Gt; & Lt; TextView android: id = "@ + id / text_pdf_file_name" Android: Layout_marginLeft = "L5dp" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" / & gt; & Lt; / LinearLayout & gt; The strange thing is: inside a piece it works, in the second it is not (the same basic activity). Another fact is that after setting the text, I get it through textView.getText (). If I try to get the text in the latter code, then I get an empty string.  

In addition to this, if I debug the code, then I get to see that it disappears before, P> is there a solution to how to correct that behavior?

piece in use:

  @ Override public view Kriattiwu ( Leautinfletr Inflatr, View Group container, bundle saved Instensstet) {see Rutwu = Infliattr. In flat (r. Leteft. Fragment_man, container, false); TextView textView = ((TextView) rootView.findViewById (R.id.text_file_name)); TextView.setText (file name); Return root view; }    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -