codigo funcional
Código Javascript:
codigo que bloquea la carga de la activityVer original
public class Opciones extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_opciones_nueva); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.opciones, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { Intent intent = new Intent(Opciones.this,Principal.class); // Handle item selection switch (item.getItemId()) { case R.id.item1principal: try { // Cambiar a la pantalla startActivity(intent); } catch (Exception e) { Toast.makeText(getBaseContext(), "Fallo", Toast.LENGTH_LONG).show(); } return true; default: return false; } } }
Código Javascript:
Ver original
public class Opciones extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_opciones_nueva); Spinner spinner = (Spinner) findViewById(R.id.spcon); final String[] datos = new String[]{"Seleccione una marca", "HTC", "Samsung", "Sony", "LG", "Motorola"}; ArrayAdapter<String> adaptador = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, datos); adaptador.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adaptador); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.opciones, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { Intent intent = new Intent(Opciones.this,Principal.class); // Handle item selection switch (item.getItemId()) { case R.id.item1principal: try { // Cambiar a la pantalla startActivity(intent); } catch (Exception e) { Toast.makeText(getBaseContext(), "Fallo", Toast.LENGTH_LONG).show(); } return true; default: return false; } } }