Home > Mobile >  The activity to the custom view value
The activity to the custom view value

Time:11-03

Requirements: activity sets of values to a custom view in

custom view code is as follows:
Public LinkedList Labels=null;//define a set is used to store from the activity of the parameter

Public void setYData (LinkedList Labels) {//the activity invokes the aim is to target is the

this. Labels=labels;
//null values}
Public LinkedList GetYData () {//by the way to define an access method
The return labels.
}


In the Activity's onCreate method
LinkedList Ylabel=new LinkedList (a);//set a collection data
Ylabel. Add (" 2006 ");
Ylabel. Add (" 2007 ");
Ylabel. Add (" 2008 ");
Ylabel. Add (" 2009 ");
Ylabel. Add (" 2010 ");
Ylabel. Add (" 2011 ");
Ylabel. Add (" 2012 ");
Ylabel. Add (" 2013 ");
Ylabel. Add (" 2014 ");
chartsView. SetYData (ylabel); //put a collection of Settings to customize the view after debugging, this is a value called


The problem is the activity of the "chartsView setYData (ylabel);" Is of value, jump into the custom view ". This labels=labels;" This sentence is null,

CodePudding user response:

These are you want to show to the layout of the above, that you do not have in the set addview, seem to be able to show it

CodePudding user response:

I call the set method in the view class can realize the value

CodePudding user response:

Dynamically add? In the new view in the list can't you preach and

CodePudding user response:

1. Check all calls setYData place ever have call
2. You to debug this. Labels=labels should see method whether labels is empty, this, labels haven't perform
3. If it is in the custom view when used is null please call the setYData to first identify the debug
  • Related