我使用的是API 23.使用使用v4的RadialTimePickerDialogFragment
父活动基于活动(我们不需要
为什么我
无法解析方法show(android.app.FragmentManager, java.lang.String中)
import com.codetroopers.betterpickers.radialtimepicker.RadialTimePickerDialogFragment;
import android.support.v4.app.DialogFragment;
import com.gtfp.workingmemory.BuildConfig;
import com.gtfp.workingmemory.R;
import com.gtfp.workingmemory.colorPicker.colorPickerActivity;
import com.gtfp.workingmemory.colorPicker.colorPickerView;
import com.gtfp.workingmemory.frmwrk.frmwrkActivity;
import com.gtfp.workingmemory.settings.SettingsActivity;
import com.gtfp.workingmemory.settings.appSettings;
import com.gtfp.workingmemory.todo.ToDoAlarm;
import com.gtfp.workingmemory.todo.ToDoItem;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.ImageButton;
import android.widget.RadioButton;
import android.widget.TextView;
import android.widget.TimePicker;
import android.widget.Toast;
:
:
:
:
RadialTimePickerDialogFragment rtpd = new RadialTimePickerDialogFragment()
.setOnTimeSetListener(editToDoItem.this)
.setStartTime(10, 10)
.setThemeDark();
rtpd.show(getFragmentManager(), FRAG_TAG_TIME_PICKER);
答案 0 :(得分:3)
解决方案:
RadialTimePickerDialogFragment
中的show方法需要v4 FragmentManager(即getSupportFragmentManager)。显然,RadialTimePickerDialogFragment是一个旧类。
这意味着将父活动从扩展活动更改为扩展android.support.v4.app.FragmentActivity
并使用getSupportFragmentManager()
而不是getFragmentManager()
。
public class editToDoItem extends android.support.v4.app.FragmentActivity
:
:
:
RadialTimePickerDialogFragment rtpd = new RadialTimePickerDialogFragment()
.setOnTimeSetListener(editToDoItem.this)
.setStartTime(mTP.getCurrentHour(),mTP.getCurrentMinute());
rtpd.show(getSupportFragmentManager(), FRAG_TAG_TIME_PICKER);