Boa tarde, estou com um problema ao executar o projeto, segui os passos da aula, porem não esta aparecendo a lista de provas como deveria aparecer conforme a vidro aula. segue print e codigos.: https://postimg.org/image/vngg6tt8x/
ListaProvasFragment:
public class ListaProvasFragment extends Fragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_lista_provas, container, false);
List<String> topicosPort = Arrays.asList("Sujeito", "Objeto direto", "Objeto indireto");
Prova provaPortugues = new Prova("Portugues", "25/05/2016", topicosPort);
List<String> topicosMat = Arrays.asList("Equacoes de segundo grau", "Trigonometria");
Prova provaMatematica = new Prova("Matematica", "27/05/2016", topicosMat);
List<Prova> provas = Arrays.asList(provaPortugues, provaMatematica);
ArrayAdapter<Prova> adapter = new ArrayAdapter<>(getContext(), android.R.layout.simple_list_item_1, provas);
ListView lista = (ListView) view.findViewById(R.id.provas_lista);
lista.setAdapter(adapter);
lista.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Prova prova = (Prova) parent.getItemAtPosition(position);
Toast.makeText(getContext(), "Clicou na Prova: " + prova, Toast.LENGTH_SHORT).show();
Intent vaiParaDetalhes = new Intent(getContext(), DetalhesProvasAcitivity.class);
vaiParaDetalhes.putExtra("prova", prova);
startActivity(vaiParaDetalhes);
}
});
return view;
}
}
ProvasActivity:
public class ProvasActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_provas);
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction tx = fragmentManager.beginTransaction();
tx.replace(R.id.frame_principal,new ListaProvasFragment());
tx.commit();
}
}
ProvasTabletActivity:
public class ProvasTabletActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_provas_tablet);
}
}
activity_provas.xml
<FrameLayout
android:id="@+id/frame_principal"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
</FrameLayout>
activity_provas_tablet.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="horizontal">
<include layout="@layout/activity_provas"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight = "1"
/>
<include layout="@layout/activity_detalhes_provas_acitivity"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
/>
</LinearLayout>
fragment_lista_provas.xml:
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:cardElevation="5dp"
app:cardUseCompatPadding="true">
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/provas_lista"/>
</android.support.v7.widget.CardView>