Wednesday, February 27, 2013

[android-developers] Re: Updating text in a DialogFragment

Hi Raymond,

I'm having same problem. I try to fix with this method. it work for me.

textview.setText() and call
textview.setVisibility(View.GONE);
textview.setVisibility(View.VISIBLE); 

Chevavan




On Friday, July 6, 2012 9:08:31 AM UTC+7, Raymond Rodgers wrote:
Hi folks,
     I've been searching for a solution to this problem for the last
couple hours but haven't turned up a solution. I'm very new to using
Fragments, but building an app based around the ViewPager in the support
library. For the most part, I haven't had any problems, but I am running
into a situation where I'm using a DialogFragment in the hopes of
building a progress indicator while my app does some things in the
background. I have an indeterminate progress indicator running in my
DialogFragment, and I want to update one of two TextViews I have in the
dialog as it progresses. I'm sending updates from my background service
& thread via a Handler that is then to update the designated TextView.
The problem is, that TextView isn't updating. I thought it might be an
issue with the static field I assign the result of the findViewById() to
(thinking that it may not exist before the dialog is displayed), so I do
a check and secondary findViewById() prior to changing the text via
TextView.setText(). Unfortunately, it appears that the TextView field is
always null, and so the view isn't getting updated.

     What am I failing to do? Do I need to do something with
FragmentTransaction or FragmentManager in order to update this TextView?

     Thank you for your assistance!
     Raymond

--
--
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.
 
 

No comments:

Post a Comment