Good afternoon. I'm starting with the Android development and I'm trying to make a navigation between several screens however the error occurs unfortunately TCC has stopped at the time of running in the emulator. I already researched and could not find the problem. can anybody help me? Thanks
My Activity
public class MenuActivity extends Activity {
private Button btnLancamentos;
private Button btnObjetivos;
private Button btnSobre;
public Button btnObjInserir;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_menu);
btnLancamentos = (Button)findViewById(R.id.btnLancamentos);
btnObjetivos = (Button)findViewById(R.id.btnObjetivos);
btnSobre = (Button)findViewById(R.id.btnSobre);
btnObjInserir = (Button)findViewById(R.id.btnObjInserir);
btnLancamentos.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TelaLanc();
}
});
btnObjetivos.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TelaObj();
}
});
btnSobre.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TelaSobre();
}
});
btnObjInserir.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TelaObjInserir();
}
});
if (savedInstanceState == null) {
getFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment())
.commit();
}
}
protected void TelaLanc() {
Intent intent = new Intent(this, TelaLancActivity.class);
startActivity(intent);
}
protected void TelaObj() {
Intent intent = new Intent(this, TelaObjActivity.class);
startActivity(intent);
}
protected void TelaSobre() {
Intent intent = new Intent(this, TelaSobreActivity.class);
startActivity(intent);
}
protected void TelaObjInserir() {
startActivity(new Intent (MenuActivity.this, TelaObjInserirActivity.class));
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
/**
* A placeholder fragment containing a simple view.
*/
public static class PlaceholderFragment extends Fragment {
public PlaceholderFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_menu, container, false);
return rootView;
}
}
}
Screen call class
package pacote.tcc;
public class TelaObjActivity extends Activity{
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.tela_obj);
}
}
Screen call class
package pacote.tcc;
public class TelaObjInserirActivity extends Activity{
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.tela_obj_inserir);
Button btVoltar = (Button) findViewById(R.id.btVoltar);
btVoltar.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent (TelaObjInserirActivity.this, MenuActivity.class));
finish();
}
});
}
}