use*_*095 -1 android android-fragments
我在片段中有以下构造函数:-
public PlaceDialogFragment(Place place, DisplayMetrics dm){
super();
this.mPlace = place;
this.mMetrics = dm;
}
Run Code Online (Sandbox Code Playgroud)
我也试过这个:-
public static final DialogFragment newInstance(Place place, DisplayMetrics dm)
{
DialogFragment fragment = new DialogFragment();
Bundle bundle = new Bundle(2);
bundle.putParcelable("Place", place);
bundle.putLong("Metrics", dm);
fragment.setArguments(bundle);
return fragment ;
}
Run Code Online (Sandbox Code Playgroud)
但是bundle.putLong("Metrics", dm) 网上有错误
这Place是一个实现 Parceable 接口的类
但我收到一条错误消息:-
Avoid non-default constructors in fragments: use a default constructor plus Fragment#setArguments(Bundle) instead
Run Code Online (Sandbox Code Playgroud)
任何建议如何解决这个问题?
| 归档时间: |
|
| 查看次数: |
4076 次 |
| 最近记录: |