I am dealing with maps apiv2. And I am getting the following error while coding for Dialog Fragment class.
Error :
Avoid non-de
Because of the nature of fragment and how there managed and shown on your screen it's very recommended not to create a non default constructor and in many cases this would cause problems in run time. In case you should do something like this:
public static final GridFragment newInstance(String tabId)
{
GridFragment f = new GridFragment();
Bundle bdl = new Bundle(2);
bdl.putString(TAB_ID, tabId);
f.setArguments(bdl);
return f;
}
and in onCreate extract the needed data from the bundle:
@Override
public void onCreate(Bundle savedInstanceState)
{
String tabId = getArguments().getString(TAB_ID);
}
And take a look at this question as well:
Do fragments really need an empty constructor?