【发布时间】:2017-01-11 10:48:22
【问题描述】:
我尝试用这个video创建BottomBar
但是,我有一个现有的项目,已经实现了几个类,当我尝试通过 Fragment 更改 AppCompatActivity 时,我的旧方法/类无法访问
旧课程的摘录:
public class ChoixFormulaire extends Fragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView=inflater.inflate(R.layout.activity_choix_formulaire,container,false);
return rootView;
}
public void formJ(View v){
Intent i = new Intent(ChoixFormulaire.this,RechercheJournalier.class);
startActivity(i);
}
public void formP(View v){
Intent i = new Intent(ChoixFormulaire.this,FormulaireRecherche.class);
startActivity(i);
}
public void retourF(View v){
Intent i = new Intent(ChoixFormulaire.this,RechercheDuJour.class);
startActivity(i);
}
但是,堡垒这部分:
(ChoixFormulaire.this,RechercheJournalier.class);
(ChoixFormulaire.this,FormulaireRecherche.class);
(ChoixFormulaire.this,RechercheDuJour.class);
我有这个错误:
"Cannot resolve constructor 'Intent(com.appli.cci.ports2a.Recherches.ChoixFormulaire, java.lang.Class<com.appli.cci.ports2a.Recherches.RecherchesJournalier>)'
【问题讨论】:
-
您可以使用活动上下文来打开新活动。
标签: java android android-fragments fragment appcompatactivity