错误的第二个参数类型与片段

时间:2016-05-27 18:01:59

标签: java android

阅读" Head First Android Programming",它有点过时了,所以本书中显示的代码也已经过时了。 My Code

Android Studio说:错误的第二个参数类型。 找到:com.xfunny.workout.WorkoutDetailFragment',required:android.app.Fragment'

CREATE VIEW QueryV5 AS 
SELECT DISTINCT 
    C.Name, P.Name AS PlanetName, SUM(T.[Time of Departure] - T.[Time of Arrival]) AS TotalTime 
FROM cmpt354_starwars.dbo.TimeTable T 
JOIN cmpt354_starwars.dbo.Characters C ON C.Name = T.CharacterName
JOIN cmpt354_starwars.dbo.Planets P ON P.Name = T.PlanetName
WHERE P.Affiliation = 'neutral' 
GROUP BY C.Name, P.Name

}

2 个答案:

答案 0 :(得分:0)

做这样的事情

android.app.Fragment details = new WorkoutDetailFragment();

而不是

WorkoutDetailFragment details = new WorkoutDetailFragment();

答案 1 :(得分:0)

由于您使用的是AppCompatActivity,因此您需要使用支持库中的Fragment,即import android.support.v4.app.Fragment

当然,如果您切换到支持片段,则需要使用getSupportFragmentManager()代替getFragmentManager()