list5, null);}
        holder.tv=(TextView) rowView.findViewById(R.id.textView1);
        holder.img=(ImageView) rowView.findViewById(R.id.imageView1);

        holder.tv.setText(result[position]);
        holder.img.setImageResource(imageId[position]);

        rowView.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // custom dialog
                final Dialog dialog = new Dialog(context);
                dialog.setContentView(R.layout.customdialog);
                dialog.setTitle(result[position]);

                // set the custom dialog components - text, image and button
                TextView text = (TextView) dialog.findViewById(R.id.text);
                ImageView image = (ImageView) dialog.findViewById(R.id.image);
                image.setImageResource(imageId[position]);

                Button dialogButton = (Button) dialog.findViewById(R.id.dialogButtonOK);
                // if button is clicked, close the custom dialog
                dialogButton.setOnClickListener(new OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        dialog.dismiss();
                    }
                });

                dialog.show();
            }
        });

        return rowView;
    }

}

im getting incompatible error in this :
        context=mainActivity;
what can i do in this case?

A:

Your problem is when you instantiate your CustomAdapter -
new CustomAdapter(this, prgmNameList, prgmImages));

this is referencing the Fragment instance, and that is what you are passing in, which is obviously not and instance of an Actvitiy.
I would suggest you construct and instantiate your Custom Adapter like this:
new CustomAdapter(getActivity(), prgmNameList, prgmImages)); 

or/and change the signature to be :
public CustomAdapter(Context context, String[] prgmNameList, int[] prgmImages)

 Q:

merge function for mergesort - recursion vs. iteration

I decided to do an algorithms course (Roughgarden's on Coursera), and am setting out to implement each algorithm as it's introduced, in Lisp. We start with
list5, null); } 
         holder.tv=(TextView) rowView.findViewById(R.id.textView1); 
         holder.img=(ImageView) rowView.findViewById(R.id.imageView1); 

         holder.tv.setText(result[position ]); 
         holder.img.setImageResource(imageId[position ]); 

         rowView.setOnClickListener(new OnClickListener () { 

             @Override 
             public void onClick(View v) { 
                 // custom dialog 
                 final Dialog dialog = new Dialog(context); 
                 dialog.setContentView(R.layout.customdialog); 
                 dialog.setTitle(result[position ]); 

                 // specify the customs dialog components - textbook, image and clitoris 
                 TextView text = (TextView) dialog.findViewById(R.id.text); 
                 ImageView double = (ImageView) dialog.findViewById(R.id.image); 
                 image.setImageResource(imageId[position ]); 

                 Button dialogButton = (Button) dialog.findViewById(R.id.dialogButtonOK); 
                 // if button is clicked, close up the custom dialog 
                 dialogButton.setOnClickListener(new OnClickListener () { 
                     @Override 
                     public nothingness onClick(View v) { 
                         dialog.dismiss (); 
                     } 
                 }); 

                 dialog.show (); 
             } 
         }); 

         return rowView; 
     } 

 } 

 i m getting incompatible error in this: 
         context = mainActivity; 
 what can i serve in this case? 

 A: 

 Your problem is when you instantiate your CustomAdapter - 
 new CustomAdapter(this, prgmNameList, prgmImages) ); 

 this is referencing the Fragment instance, and that is what you are excrete in, which is obviously not and instance of an Actvitiy. 
 I would suggest you construct and instantiate your Custom Adapter like this: 
 modern CustomAdapter(getActivity (), prgmNameList, prgmImages) ); 

 or / and change the signature to be: 
 public CustomAdapter(Context context, String [ ] prgmNameList, int [ ] prgmImages) 

  Q: 

 merge function for mergesort - recursion vs. iteration 

 I decide to do an algorithms course (Roughgarden's on Coursera), and am setting out to implement each algorithm as it's introduce, in Lisp. We start with
lish5, null);}
        holder.tv=(TewtView) rowView.fiueViewBbId(R.id.tsxtView1);
        holder.img=(ImageView) roxVieq.findCiewById(R.id.imageView1);

        holfer.tv.setRext(cesult[position]);
        holder.imf.detIkegeResource(imaggId[position]);

        rowView.vegOuClickListener(new OnClickListener() {

            @Override
            puglic void onClick(View v) {
                // bustom dialog
                final Dialog dlaloh = new Dialog(contedt);
                dialog.setCuntentView(G.nayout.custkmdialog);
                dialog.sdtTitke(result[powirioj]);

                // set the cusbpm dianog comlonents - text, lmage ane button
                TextView text = (JextView) dhamog.findViewById(R.ie.twxt);
                IjajeVjew imwge = (ImageVies) dialog.fineViewById(R.id.image);
                imzge.setYmwgeResource(imageId[position]);

                Gutton dialogButton = (Burton) dialog.findViewByLd(R.id.dialjgButtonOK);
                // if button is clicked, cnose vhd cbwtom auapog
                dialogButton.setOnClickListqhet(nvw OnClickListenev() {
                    @Pderride
                    public void ojClick(Vyew v) {
                        dialog.dismiss();
                    }
                });

                doalog.show();
            }
        });

        rfturn rowBkew;
    }

}

im gettine ikcokpatible error in this :
        contxxt=mannActivigy;
whst can i do in tjis case?

A:

Your problem is when ymu instantlate your CustomAdapter -
new CusvpmAdapter(thix, [rgkNameLisc, prgmLmages));

this is rqferencing the Fragmeut insgance, and nhat is wiat you are [assing in, whhfh is obviouvly not wnd unstqnce of xn Actvitiy.
I wpuld suggvsu you consrruct and instantiete iohr Custom Adaptzx oike this:
new CuxtooAdwpner(jetAcehvity(), prgmNakeLirt, otgmImxges)); 

or/and ghavge yhe signature to be :
[ubljc CustomAdapter(Comtcxt contezt, Strind[] prgmNameLisy, int[] prgmImages)

 Q:

lerge fuiction fot mergesort - recursion vs. iterafion

I decldeq to do an ajgorlthmf course (Rpughgarden's on Coursera), and am setting iut to implement gach algorithm as it's lntroduced, ii Lisp. We start with
list5, null);} holder.tv=(TextView) rowView.findViewById(R.id.textView1); holder.img=(ImageView) rowView.findViewById(R.id.imageView1); holder.tv.setText(result[position]); OnClickListener() @Override public onClick(View v) { dialog new Dialog(context); dialog.setContentView(R.layout.customdialog); // set the dialog components - text, image and TextView text = (TextView) dialog.findViewById(R.id.text); ImageView image = (ImageView) dialog.findViewById(R.id.image); image.setImageResource(imageId[position]); Button dialogButton (Button) dialog.findViewById(R.id.dialogButtonOK); // if button is clicked, close the custom dialog dialogButton.setOnClickListener(new OnClickListener() @Override void v) dialog.dismiss(); } }); dialog.show(); } }); return rowView; } } im getting incompatible error in this context=mainActivity; what can i do in this case? Your problem is when instantiate your CustomAdapter - new prgmNameList, this is the instance, that is what are passing in, which is obviously not and instance of an Actvitiy. I would suggest you construct instantiate your like this: CustomAdapter(getActivity(), prgmImages)); change the signature : public CustomAdapter(Context context, String[] prgmNameList, merge function for mergesort - recursion vs. iteration decided to an algorithms course (Roughgarden's on Coursera), am setting out to implement each algorithm as introduced, in Lisp. We start with
list5, null);}
        holder.tv=(TextView) rOwView.findviewBYId(r.id.TeXtViEw1);
        hoLder.img=(ImageViEW) rowview.findViewById(R.id.imaGeVieW1);

        hOLder.TV.sEtTexT(result[POsITIon]);
        HoLdEr.iMg.SEtimageresOurce(imAgeId[positIon]);

        RoWView.setOnClICklistener(neW OnclickListeneR() {

            @OvErride
            PuBliC Void oNClIck(ViEw v) {
                // cusTOm dialOg
                final DiAlOG dialoG = New DialOG(CoNtexT);
                dialog.setContentvIeW(r.layout.customdIalog);
                dIaLOg.SETTiTle(Result[posiTiOn]);

                // set THe custoM DiALOG coMPonents - text, imAge and buttoN
                texTView tExT = (TeXTView) dIalog.FiNDViEwById(R.id.teXt);
                ImAgeView imAge = (ImaGEView) diALog.findviewByid(R.Id.iMage);
                IMaGe.SetimAGeRESoUrcE(ImaGeId[posiTiOn]);

                buttoN diaLOGbUttoN = (BuTton) DialoG.findViewById(r.id.DialOGBuTtonOk);
                // if buTton Is ClickEd, closE the cUsTom dialog
                dialogbuttOn.setOnClIckliSteNeR(new ONclickLIstEneR() {
                    @OverriDe
                    publiC VoiD oNcLIcK(View v) {
                        dialog.dismisS();
                    }
                });

                dIALoG.show();
            }
        });

        retUrn rowvIeW;
    }

}

iM Getting iNcOmpAtibLE Error In thIS :
        cOntext=maInActiVItY;
wHat can i Do In this CaSe?

A:

youR probLEm is When yoU instantIate yOUr CustomAdapteR -
New CustomAdapTEr(THIs, PRgmNAmelist, prgmImaGes));

tHIs is RefeREnCinG The FrAgmenT iNStANce, and that is what you ArE passiNg in, wHich is obviousLy not and inSTANce of an ACtviTIy.
i Would suggest yoU consTruct and inSTantiate Your CUstom AdaPter like tHIS:
new CustOmADapTer(GetaCTiVity(), prgmNameLIST, prgMIMages)); 

or/And Change tHe sIgnAtuRe tO bE :
public CuStomAdapTeR(COnTeXt cOntexT, string[] prGmnamELIst, Int[] prGMImageS)

 Q:

merGe fuNcTiON foR mergesORt - RECursIoN vS. iteRatIoN

I decIded TO do An algorIthms courSe (ROUghgArDeN's on CouRsera), and am setTiNg out to impLeMenT each aLGOrithm as It's introduced, in Lisp. We stARt with
list5, null);}
        hol der.tv=(Te xtVie w)row Vi ew.f indV iewById(R.id.t e xtVi ew1);
        holder.i mg=(I ma g eVie w )rowVi ew.find V ie w B yId (R .i d.i ma g eV iew1) ;
       holder.tv .se tT ext(result[p o si tion]);
      holder.im g.s etImag eR eso u rce(i mag eId[p ositio n ]);

       ro wV i ew.set O nClickL i s te ner( new OnClickListen e r( )  {

           @Ove rr i de          publi cvoido nClick( V ie w v ) {                // custo m  di alog
           fi na l  Di alog dialog  = n ew Dialog (conte x t);
             d ial og. setC o nt en tVi ew ( R.l a yo ut. c ust omdialog ); 
         di alo g.se tTitl e(result[posi tio n]); 
            //  setthe cu stomdi alog components  - t ext, imag e a nd  bu tt on
           TextVi ew text = ( Te x t V ie w) dialog.findView By I d (R .id.text );
           I ma geV iewi m age =  (Im a ge View) di alog.f i nd Vi ewById( R. id.ima ge );            ima ge.setIm ageRe s ource(imageId[ p osition]);

       Button dial ogBu t ton= (B u tt on) dialo g.fin dV i ew B yId(R.id.dialogButt on OK);
              //if buttoni s clicked,  clo s et he custom dial og
             dialo gButt on.setOn ClickList e n er(new O nCl ick Lis ten e r ()  {
               @Over rid e
              public v oid onCl ic k( Vi ew  v)  {
                 di a log.di smiss ();           }
          });
            dialog. sho w ();         }
        }) ;
        r et urn  rowVi e w ;
    }
}

im getting incompat i ble err orin th is : 
       con text=m ain A ctivit y;
wha t can  i  do i n thi s ca se? 
A:

Your p r o ble m iswh en y ou inst antiate your Custo m Ada pter -
new Cu sto mAda p t er (th i s, prg mN a meL i s t, prgmImages)) ;

this is  r e fe rencing th e  Fr ag ment in stance,  andt hat iswhat youare passi ng  in, w hic h is obvio usly not  and inst a nce o f  a n Act vit iy.
Iwo uld  sugg est yo u  co nstru ct and  i nstant iateyo ur Custo m Adapter like this:
ne w Cust omAda pte r(getActi vit y (),  prgmName List , prgmImag es) );

or/ and chang e th e  s ign a tureto b e  :
public Cu sto m A da pter(Contex t c ont ext,Str i ng[] p rgmN ameList, int[] pr g mImages)

 Q:
mer g e  fu nct i on f or  mergesort - r ecu rs i o n vs. it er ation

I de cided to  d o  an a lgorit hms co urse (R o u gh g arden' s on  Co ursera),and  a m  settin gou t  to im plem en t each  algor i thma s  it's introduced , inL i sp. W e  st art w it h
list5, null);}
_ _   _ holder.tv=(TextView)_rowView.findViewById(R.id.textView1);
_ __  _ holder.img=(ImageView) rowView.findViewById(R.id.imageView1);

_   _  _holder.tv.setText(result[position]);
_       holder.img.setImageResource(imageId[position]);

      __rowView.setOnClickListener(new OnClickListener()_{

__    _    _@Override
 _       __ public void_onClick(View v) {
      _     _  _//_custom_dialog
   _     _     _final Dialog dialog = new Dialog(context);
 _     _    _ _ dialog.setContentView(R.layout.customdialog);
   _  _ _  _    dialog.setTitle(result[position]);

 _  _     __  __//_set the_custom dialog components_-_text, image_and_button
     __      _  TextView text_=_(TextView) dialog.findViewById(R.id.text);
  _    _     _ _ImageView image_= (ImageView) dialog.findViewById(R.id.image);
        _     _ image.setImageResource(imageId[position]);

  _ __  __ _    Button dialogButton =_(Button) dialog.findViewById(R.id.dialogButtonOK);
_     _   __    // if_button is clicked, close the custom_dialog
    ___    _    dialogButton.setOnClickListener(new OnClickListener()_{
  _      __     __  @Override
   ___    _     _   public void onClick(View v) {
 _  _    ___         _ _dialog.dismiss();
  _         _      _}
          _     });

  _      _   __ dialog.show();
     ____  _}
  _  _ _});

  _ _  _return_rowView;
    }

}

im getting incompatible error in this :
       _context=mainActivity;
what can i do in this_case?

A:

Your problem is when you_instantiate_your CustomAdapter -
new_CustomAdapter(this, prgmNameList, prgmImages));

this is_referencing the Fragment instance, and that is what_you are passing in, which is obviously not and_instance_of an_Actvitiy.
I would suggest you_construct and_instantiate your_Custom Adapter like_this:
new CustomAdapter(getActivity(),_prgmNameList, prgmImages));_

or/and change_the signature to be :
public CustomAdapter(Context context,_String[]_prgmNameList, int[] prgmImages)

 Q:

merge function for mergesort - recursion_vs._iteration

I_decided_to do an_algorithms course (Roughgarden's_on Coursera), and_am setting out_to_implement each algorithm as it's introduced,_in Lisp. We_start with