I'm running my app, but it returns the following error:
Caused by: android.view.InflateException: Binary XML file line #10: Error inflating class android.widget.ListView
And I'm simply running the App and opening my ListView directly with a button ..
MainActivity
public class MainActivity extends Activity {
ListView listaPrincipal;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
listaPrincipal = (ListView) findViewById(R.id.lstPrincipal);
}
public void adicionarVaga(View view){
Intent intent = new Intent(MainActivity.this, VagasActivity.class);
startActivity(intent);
}
public void alterarVaga(View view){
Intent intent = new Intent(MainActivity.this, AlterarVagas.class);
startActivity(intent);
}
}
Activity_main.xml
<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/lstPrincipal"
android:clickable="true"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_above="@+id/btAddVaga"
android:onClick="alterarVaga"
android:layout_alignRight="@+id/gridLayout"
android:layout_alignEnd="@+id/gridLayout" />
<GridLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:columnCount="9"
android:rowCount="2"
android:id="@+id/gridLayout">
<TextView
android:id="@+id/txtNumeroVaga"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:clickable="true"
android:text="ID"
android:layout_row="0"
android:layout_column="0" />
<TextView
android:id="@+id/txtPropretarioVaga"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:clickable="true"
android:text="Ocupante Atual"
android:layout_row="0"
android:layout_column="7"
android:layout_rowSpan="2" />
</GridLayout>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="+"
android:id="@+id/btAddVaga"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:onClick="adicionarVaga"/>
I'll be grateful to demonstrate what's missing in my code .. Thanks