public class TopmenuFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.button_topmenu, null);
ImageButton movieRankingbtn = (ImageButton)view.findViewById(R.id.moiverankingbtnon);
movieRankingbtn.setOnClickListener(new OnClickListener() {
public void onClick(View v){
FragmentTransaction transaction = getFragmentManager().beginTransaction();
Fragment newFragment = new movieRankingActivity();
//transaction.replace(R.id.framelayout_main, newFragment);
transaction.commit();
}
});
로 TopmenuFragment 를 구현했습니다.
화면은 잘 뜨구요, 버튼 이벤트도 잘 실행 됩니다.
이제 화면을 바꾸려고 이제 버튼 이벤트 안의 내용을 수정 중인데
Fragment newFragment = new movieRankingActivity();
에서 자꾸 에러가 뜹니다. replace를 하려고 Fragment를 정의하는 중인데
movieRankingActivity() 내용은 아래와 같습니다.
@SuppressLint("NewApi")
public class movieRankingActivity extends Fragment {
/** Called when the activity is first created. */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.activity_movieranking, null);
return view ;
}
}
코드가 정말 이것 뿐인데 자꾸 fragment가 아니라네요 ;;
ㅠㅠ 힌트나 수정 할 것 좀 도와주세요