2016-08-24 51 views
0

其實我正在從一個片段到另一個片段,它將異常上下文顯示爲空。有沒有人爲此提供解決方案?上下文中的問題

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; 
} 

回答

0

然後改變上下文活動

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; 
} 
+0

它不工作 –

+0

再次檢查更新的答案 –

+0

不工作 –