0

Actually I am going from one fragment to another fragment and it shows exception context as null. Does any one has a solution for this?

dashboard_newrequest_list.setAdapter(new OngingmechanicAdapter(getActivity(),
                                                    Newrequest_Makes_Name,Newrequest_Model_Name,Newrequest_Servicenames,Newrequest_Pknames,Newrequest_Location,Newrequest_order_number,Newrequest_Bookid,Newrequest_Imgpath));

OngingmechanicAdapter

Context con;
 psapplication appication;
public OngingmechanicAdapter(Context con,
                             ArrayList<String> Newrequest_Makes_Name,  ArrayList<String> Newrequest_Model_Name,
                             ArrayList<String> Newrequest_Servicenames, ArrayList<String> Newrequest_Pknames, ArrayList<String> Newrequest_Location,
                             ArrayList<String> Newrequest_Bookid,
                             ArrayList<String> Newrequest_order_number,
                             ArrayList<String> Newrequest_Imgpath
                           ) {


    appication=new psapplication(con);

    this.Newrequest_Makes_Name  = Newrequest_Makes_Name;
    this.Newrequest_Model_Name = Newrequest_Model_Name;
    this.Newrequest_Servicenames = Newrequest_Servicenames;
    this.Newrequest_Pknames = Newrequest_Pknames;
    this.Newrequest_Location = Newrequest_Location;
    this.Newrequest_Bookid = Newrequest_Bookid;
    this.Newrequest_order_number = Newrequest_order_number;
    this.Newrequest_Imgpath = Newrequest_Imgpath;
    this.con = con;
}
Kunal Yadav
  • 139
  • 10
A.asha
  • 45
  • 6

1 Answers1

0

then to change context to Activity

Activity con;

public OngingmechanicAdapter(Activity con,rayList<String.....) {


    appication=new psapplication(con);
   // and also make psapplication constructor parameter to Activity

    this.Newrequest_Makes_Name  = Newrequest_Makes_Name;
    ...
    this.con = con;
}
Sohail Zahid
  • 8,099
  • 2
  • 25
  • 41