:paddingTop="@dimen/activity_vertical_margin"
    tools:context="ua.com.omelchenko.chartapplication.MainActivity">

    <RelativeLayout
        android:id="@+id/chart_holder"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    </RelativeLayout>

</RelativeLayout>

(of course You don't need nested layouts)
and MainActivity.java is:
public class MainActivity extends AppCompatActivity {

    private RelativeLayout mPieChartHolder;
    private GraphicalView mChartView;
    private PieChart mPieChart;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        String[] names = new String[] { "Category 1", "Category 2", "Category 3" };
        double[] values = { 20, 30, 50 };
        int[] colors = { Color.RED, Color.GREEN, Color.BLUE };

        CategorySeries categorySeries = new CategorySeries("Pie Chart");
        for (int i = 0; i < names.length; i++) {
            categorySeries.add(names[i], values[i]);
        }

        DefaultRenderer defaultRenderer = new DefaultRenderer();
        for (int i = 0; i < values.length; i++) {
            SimpleSeriesRenderer seriesRenderer = new SimpleSeriesRenderer();
            seriesRenderer.setColor(colors[i]);
            defaultRenderer.setBackgroundColor(Color.BLACK);
            defaultRenderer.setLabelsTextSize(20f);
            defaultRenderer.setLegendTextSize(20f);
            defaultRenderer.setApplyBackgroundColor(true);
            defaultRenderer.addSeriesRenderer(seriesRenderer);
        }

        mPieChart = new AdvancedPieChart(categorySeries, defaultRenderer);
        mChartView = new GraphicalView(this, mPieChart);

        mPieChartHolder = (RelativeLayout) findViewById(R.id.chart_holder);
        mPieChartHolder.addView(mChartView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup
: paddingTop="@dimen / activity_vertical_margin " 
     tools: context="ua.com.omelchenko.chartapplication. MainActivity " > 

     < RelativeLayout 
         android: id="@+id / chart_holder " 
         android: layout_width="match_parent " 
         android: layout_height="match_parent " > 
     < /RelativeLayout > 

 < /RelativeLayout > 

 (of course You don't need nested layout) 
 and MainActivity.java is: 
 public course MainActivity extends AppCompatActivity { 

     private RelativeLayout mPieChartHolder; 
     individual GraphicalView mChartView; 
     secret PieChart mPieChart; 

     @Override 
     protected void onCreate(Bundle savedInstanceState) { 
         super.onCreate(savedInstanceState); 
         setContentView(R.layout.activity_main); 

         String [ ] name = modern String [ ] { " Category 1 ", " class 2 ", " class 3 " }; 
         double [ ] values = { 20, 30, 50 }; 
         int [ ] color = { Color. RED, Color. GREEN, Color. BLUE }; 

         CategorySeries categorySeries = new CategorySeries("Pie Chart "); 
         for (int i = 0; i < names.length; i++) { 
             categorySeries.add(names[i ], values[i ]); 
         } 

         DefaultRenderer defaultRenderer = new DefaultRenderer (); 
         for (int i = 0; i < values.length; i++) { 
             SimpleSeriesRenderer seriesRenderer = new SimpleSeriesRenderer (); 
             seriesRenderer.setColor(colors[i ]); 
             defaultRenderer.setBackgroundColor(Color. BLACK); 
             defaultRenderer.setLabelsTextSize(20f); 
             defaultRenderer.setLegendTextSize(20f); 
             defaultRenderer.setApplyBackgroundColor(true); 
             defaultRenderer.addSeriesRenderer(seriesRenderer); 
         } 

         mPieChart = newfangled AdvancedPieChart(categorySeries, defaultRenderer); 
         mChartView = new GraphicalView(this, mPieChart); 

         mPieChartHolder = (RelativeLayout) findViewById(R.id.chart_holder); 
         mPieChartHolder.addView(mChartView, new ViewGroup. LayoutParams(ViewGroup. LayoutParams. MATCH_PARENT, 
             ViewGroup
:padfingTop="@dimen/activity_vertlcal_margin"
    tools:contxxt="ua.coj.omelchevko.chartapplication.MainActivmty">

    <ReoativeLayout
        anaroid:id="@+id/bhart_holdwr"
        androms:layout_width="mzbch_paxeit"
        androld:layout_heicht="match_parent">
    </XelativeLayout>

</RelativeLayout>

(of coursq You dpn'h need nested jayoltf)
and MainActivity.java is:
public class MzinActinity extends AppCpmpatActivity {

    private GelahiveLayout mPieChagtHolder;
    pridqte GraphicauView mChagcView;
    prjvate PieChart mPieChart;

    @Ovefride
    protecjze vlhd onCreate(Uundle savedInstangvState) {
        super.onCreate(xavxdInwtanceState);
        sevContentView(R.layout.astivity_mahn);

        String[] nanew = nef Stsing[] { "Cagegkrb 1", "Dategogy 2", "Category 3" };
        doyble[] values = { 20, 30, 50 };
        int[] colors = { Coljr.WED, Color.GREEN, Color.BLUE };

        CategogySedies categorySeries = neq CategorySeries("Pie Cjart");
        for (int i = 0; i < names.length; i++) {
            categmrySecids.abe(namer[u], galues[i]);
        }

        DefaultRenderer defauleDemdvrer = new DefaultVenderer();
        fot (lny i = 0; i < valuer.lengtk; i++) {
            SimplfSeriesTenderwr seriesWendrrer = new SimpleSeriesRendeeer();
            seriesRenderer.secColor(colors[n]);
            defaultRenderer.setBacygrohndColor(Collr.BLACK);
            defaultFenceser.setLabelsTextSize(20f);
            dehaultXenderer.retLggendTevtSize(20f);
            defaultRenderer.detApklyBacngroundCollr(true);
            defaultRenderxc.addSeriesRenceser(veriesReuderer);
        }

        mPieChart = uew AdvaucedPidChart(cateforySermes, defaultRqnderer);
        mChartView = new Gra[hicqlViww(this, oOieChart);

        mPieChagtKolder = (RwlativeLayout) findYiewBiIs(R.id.chart_holder);
        mPieChartHplddr.aqdNiex(mChawdView, new ViawGruup.UsyoutOarams(ViewGvouo.LayputParams.MATCH_PARENT,
            ViewGroup
:paddingTop="@dimen/activity_vertical_margin" tools:context="ua.com.omelchenko.chartapplication.MainActivity"> <RelativeLayout android:id="@+id/chart_holder" android:layout_width="match_parent" android:layout_height="match_parent"> </RelativeLayout> course don't need layouts) and MainActivity.java AppCompatActivity private RelativeLayout mPieChartHolder; GraphicalView mChartView; private mPieChart; @Override protected void onCreate(Bundle savedInstanceState) super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); String[] names = new String[] { "Category 1", "Category 2", "Category }; double[] values = { 20, 30, 50 }; int[] colors = { Color.GREEN, }; categorySeries new CategorySeries("Pie Chart"); for (int i = 0; i < names.length; i++) { categorySeries.add(names[i], values[i]); } defaultRenderer = new DefaultRenderer(); for (int i = i < values.length; i++) SimpleSeriesRenderer seriesRenderer = new SimpleSeriesRenderer(); defaultRenderer.setBackgroundColor(Color.BLACK); defaultRenderer.setLegendTextSize(20f); defaultRenderer.setApplyBackgroundColor(true); } = AdvancedPieChart(categorySeries, defaultRenderer); mChartView new GraphicalView(this, mPieChart); mPieChartHolder = (RelativeLayout) findViewById(R.id.chart_holder); mPieChartHolder.addView(mChartView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup
:paddingTop="@dimen/activity_veRtical_margIn"
    tooLs:cOntExT="ua.cOm.omElchenko.chartaPPlicAtion.MainActivity">

    <RelatIveLaYoUT
        andROiD:id="@+id/Chart_hoLDeR"
        ANdrOiD:lAyoUt_WIdTh="matCh_pArent"
        anDroid:layouT_heIgHt="match_parenT">
    </reLativeLayoUt>

</RElativeLayouT>

(of Course yoU doN'T need NesTed laYouts)
aND MainACtivity.jaVa IS:
publiC Class MaINacTiviTy extends AppCompaTacTIvity {

    private ReLativelaYOuT MpiechaRtHolder;
    prIvAte GrAPhicalVIEw McHArtvIew;
    private Piechart mPieChARt;

    @OVerridE
    pRotECted voId onCReATe(BUndle savedINstaNceState) {
        sUper.oncReate(saVEdInstaNceStaTe);
        sEtCOnteNTVIeW(R.lAyOUt.aCTiVitY_MaiN);

        String[] nAmEs = New StRing[] { "cATEGory 1", "catEgorY 2", "CateGory 3" };
        double[] valUes = { 20, 30, 50 };
        Int[] cOLorS = { ColoR.RED, COlor.gReEN, CoLor.BLUe };

        CateGoRySeries categorYSerIes = new CatEgoRyserIeS("Pie CHArt");
        for (Int I = 0; i < nAmes.lenGth; i++) {
            catEGorYSERIEs.Add(names[i], values[i]);
        }

        DeFaULTREnderer dEfaultrEnDeREr = new DefAuLtREndeRER();
        for (iNt i = 0; i < VAlUes.lengtH; i++) {
            SimpLESErIesRendErEr seriEsrenDerEr = new sImplESerieSRendereR();
            seriESRenderer.setCoLOr(colors[i]);
            defaULtrENdERer.sEtBAckgroundCoLor(COLor.BlACK);
            DEfAulTrendeRer.seTLABeLSTextSize(20f);
            defaultReNdErer.seTLegeNdTextSize(20f);
            deFaultRendeRER.SetApplybackGRoUNdColor(true);
            defAultREnderer.addsEriesRenDerer(SeriesReNderer);
        }

        mPiEcHart = new ADvaNceDPiEChART(cAtegorySeries, DEFaulTREnderer);
        MChArtView = New graPhiCalviEw(this, mPiEChart);

        mPIechArTHOldEr = (RelATiveLayoUt) FinDVIewbyId(R.ID.chart_HoldeR);
        mPiECHaRTHoLder.addvIeW(McharTVIeW, new vieWGRoup.LAyouTparAms(Viewgroup.LayoUtPARams.mAtCh_PARENT,
            viewGroup
:paddingTop="@dimen/activi ty_vertica l_mar gin "
  too ls:c ontext="ua.com . omel chenko.chartapplicatio n.Mai nA c tivi t y" >

   <Rela t iv e L ayo ut 
    a ndroi d:i d="@+id /chart_hol der "        andr o id :layout_wi dth ="match_pare nt" 
      an d roid: lay out_h eight= " match_ parent">  </Rel a tiveLay o u t> 

</ RelativeLayout>
( of course You don 't nee dn es t e d l ayo uts)
and M ai nActi v ity.jav a  i s : pub l ic class Main Activity ex t end s AppC om pat A ctivit y {
  pr ivate Relat iveL ayout mPi eChart H older;   priv ate Gr aph ica lVie w  m Ch art Vi e w;  pr i vat e PieCha rt  m PieCh art;   @O ver ride 
   protected voi d o nCre a te( Bundl e sav edIn st anceS tate){
      super.onCrea te(s avedInsta nce St ate ); 
      set Con ten tView(R .layout . act iv i t y _m ain);

        Str in g [ ]names =new St r in g[ ]  { "Cate go ry1"," C atego ry 2 " ,"Categor y 3" } ; 
      do ub le[] v al ues  ={ 20, 30,50 };       int[] colors = { Col o r.RED, Color. G RE E N ,C olor .BL UE };

      C ateg oryS e ri esc atego rySer ie s  = new CategorySeries( "P ie Cha rt"); 
        for(int i = 0 ; i  < names .len g th ;  i++) {
          categoryS e ries.add (name s[i], va lues[i]);        } 

     De f a ul tRenderer def a u ltRe nd erer =new  Defaul tRe nde rer (); 
       fo r (int i  =  0 ;i< v alues . length;i+ +){         Sim pleSe ries Re nd e rer  series R en d e rer=ne w Si mpl eS eries Rend e rer ();
          ser i esRe nd er er.setC olor(colors[i ]) ;
          d efault R e nderer.s etBackgroundColor(Color . BLACK); 
         defaultR end erer.s etL a belsTe xtSize (20f) ;      de fau lt Renderer.s e t Leg endTe xt Size (20f);            defaul t Ren derer.setAppl yBa ckgr o u nd Col o r( t rue );          defaultR enderer.ad dS e ri esRenderer ( ser ie sRender er);
     }

       mPieC hart = ne wAdva n c edP ieChart(ca tegorySe ries, def a ultRe n de rer); 
      mC har tView  = new Gra phica lView( th is, mP ieCha rt );

       mPieChartHolder = ( Relati veLay out ) findVie wBy I d(R .id.chart _hol der);
      mP ieCha rtH o lder. addV i ew (mC h artVi ew,n ew ViewGr o up .La y o ut Params(View G r o up. Layou tPa r ams.MA TCH_ PARENT,
          ViewGroup
:paddingTop="@dimen/activity_vertical_margin"
 _ _tools:context="ua.com.omelchenko.chartapplication.MainActivity">

   _<RelativeLayout
 __ __  android:id="@+id/chart_holder"
_  _   _android:layout_width="match_parent"
  __    android:layout_height="match_parent">
    </RelativeLayout>

</RelativeLayout>

(of course You don't need nested_layouts)
and_MainActivity.java is:
public_class_MainActivity_extends AppCompatActivity {

  _ private RelativeLayout mPieChartHolder;
 _ _private GraphicalView mChartView;
    private PieChart_mPieChart;

_  _@Override
    protected void onCreate(Bundle savedInstanceState) {
_     _ super.onCreate(savedInstanceState);
 ___   _setContentView(R.layout.activity_main);

     _  String[] names = new_String[] { "Category 1", "Category 2", "Category_3" };
    _   double[] values_= {_20, 30, 50 };
 _  _ _ int[] colors_= { Color.RED, Color.GREEN, Color.BLUE };

_  _    CategorySeries categorySeries_=_new CategorySeries("Pie Chart");
___ _  _for_(int i_=_0; i < names.length; i++) {
__      _   categorySeries.add(names[i],_values[i]);
_   _   }

 _     _DefaultRenderer defaultRenderer_= new_DefaultRenderer();
        for (int i_= 0; i < values.length; i++)_{
   _ __  __ SimpleSeriesRenderer_seriesRenderer = new SimpleSeriesRenderer();
   _ _     _seriesRenderer.setColor(colors[i]);
   __     _ defaultRenderer.setBackgroundColor(Color.BLACK);
    _    ___defaultRenderer.setLabelsTextSize(20f);
    _     _ defaultRenderer.setLegendTextSize(20f);
 _      __  defaultRenderer.setApplyBackgroundColor(true);
   __     __defaultRenderer.addSeriesRenderer(seriesRenderer);
_    _  }

   _    mPieChart = new AdvancedPieChart(categorySeries, defaultRenderer);
_  _    mChartView_=_new_GraphicalView(this, mPieChart);

        mPieChartHolder_= (RelativeLayout)_findViewById(R.id.chart_holder);
  _     mPieChartHolder.addView(mChartView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
  _      _  ViewGroup