我只是创建一个简单/空白片段,它应该使用Mosby
框架。每次我使用getView()
方法时,我都会收到错误:
java.lang.ClassCastException: de.xxx.projectZ.packA.AFragment无法强制转换为 de.xxx.projectZ.packA.AView
public interface AView extends MvpLceView<List<Persons>> {
// empty
}
导致错误的演示者
public class APresenter extends MvpBasePresenter<AView> {
PersonsRepository personsRepository;
@Inject
public APresenter(PersonsRepositoryImpl personsRepository) {
this.personsRepository = personsRepository;
}
public void loadPersons() {
// ERROR
if (isViewAttached())
getView().showLoading(true);
List<Person> persons = personsRepository.getPersons();
if (isViewAttached()) {
}
}
}
我的片段标题
public class PersonsFragment
extends MvpLceFragment<SwipeRefreshLayout, List<Person>, AView, APresenter> {
有人知道为什么会这样吗?
答案 0 :(得分:2)
你的片段没有实现public class PersonsFragment
extends MvpLceFragment<SwipeRefreshLayout, List<Person>, AView, APresenter>
implements AView // This is missing
{
...
}
...
<svg>
<path id="MyPath" d="M 100 200
C 200 100 300 0 400 100
C 500 200 600 300 700 200
C 800 100 900 100 900 100"/>
<use id="curve" xlink:href="#MyPath" fill="none" stroke="red" />
<text id="origText" fill="white">
<textpath xlink:href="#MyPath" >
OH NOES!, DANCING TEXT ARRIVED!
<animate attributeName="startOffset" from="100%" to ="-100%"
begin="0s" dur="10s" repeatCount="indefinite" keyTimes="0;1"
calcMode="spline" keySplines="0 0 1 1"/>
</textpath>
</text>
</svg>
var t = document.getElementById('origText');
var t_text = t.textContent; // "We go up...."
var curve = document.getElementById("MyPath");
var len = curve.getTotalLength(); // curve length
var steps = len/t_text.length; // get width of step
var start_pt = 0; // start at beginning
var prev_pt = curve.getPointAtLength(0); // measure first step
t.textContent = ""; // clear up original text;
for (var i = 0; i < t_text.length; ++i) { // char loop
var new_pt = curve.getPointAtLength(start_pt); // measure pt
var ts = genTspan(t_text[i], prev_pt, new_pt); // tspan
t.appendChild(ts); // add to <text>
start_pt += steps; // go to next step (point)
prev_pt = new_pt; // remember previous point
}
function genTspan(myChar,prev_pt,new_pt) {
var tspan = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
tspan.setAttributeNS(null, 'dy', new_pt.y - prev_pt.y);
tspan.textContent = myChar;
return tspan;
}