Have you verified that the layout and view are not null?

----------------------------------------------------------------------
There are only 10 types of people in the world...
Those who know binary and those who don't.
----------------------------------------------------------------------


On Sun, Nov 22, 2009 at 3:55 PM, keyvez <[email protected]> wrote:

> Can anyone answer this questions or is this not a beginner question?
>
> On Nov 4, 3:14 am, keyvez <[email protected]> wrote:
> > I am populating (through inflation) an XML file and then I want to
> > update the textSize of each TextView and redraw it, but it's not
> > updating the view with new textSize.
> >
> > Here is the code:
> >
> > public class Contacts extends ListActivity {
> >     private SimpleCursorAdapter mAdapter;
> >         private Integer totalContactsMade;
> >
> >         /** Called when the activity is first created. */
> >     @Override
> >     public void onCreate(Bundle savedInstanceState) {
> >         super.onCreate(savedInstanceState);
> >         Cursor cursor = getContentResolver().query(People.CONTENT_URI,
> > null, null, null, People.NAME + " ASC");
> >         startManagingCursor(cursor);
> >
> >         String[] columns = new String[] { People.NAME};
> >         int[] names = new int[] {R.id.row_entry};
> >
> >         mAdapter = new SimpleCursorAdapter(this, R.layout.main,
> > cursor, columns, names);
> >         setListAdapter(mAdapter);
> >
> >         Integer contactCount = getListView().getCount();
> >
> >                 for(Integer i=0; i<contactCount; i++) {
> >
> >                         LinearLayout layout = (LinearLayout)
> mAdapter.getView(i, null,
> > null);
> >                         if(layout != null) {
> >                                 TextView view = (TextView)
> layout.findViewById(R.id.row_entry);
> >                                 if(view != null) {
> >                                         view.setTextSize(6.0f);
> >                                         view.requestFocus();
> >                                         view.getParent().requestLayout();
> >                                         view.requestLayout();
> >                                         view.postInvalidate();
> >
> >                                        // I have tried to invalidate
> > the layout also, but it doesn't work
> >                                         layout.requestFocus();
> >                                         layout.requestLayout();
> >                                         layout.postInvalidate();
> >                                 }
> >                         }
> >
> >                 }
> >
> >     }
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Beginners" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-beginners%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-beginners?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to