Im tratando de hacerlo de modo que cuando hago clic en elementos específicos en mi lista de lista, me lleve a pantallas específicas. ¿Alguien sabe como hacer esto? Estoy usando el siguiente código para esteAndroid- Abrir nueva actividad en clickview clics
Además. Estoy tratando de hacer que aparezca un solo botón atrás en la parte inferior de la vista de lista. Hasta ahora solo puedo hacer que aparezca en cada entrada de la lista, ¡la ayuda sería muy apreciada!
import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
public class Advertise extends ListActivity {
/** Called when the activity is first created. */
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
// Create an array of Strings, that will be put to our ListActivity
String[] names = new String[] { "Linux", "Windows7", "Eclipse", "Suse",
"Ubuntu", "Solaris", "Android", "iPhone" };
// Use your own layout and point the adapter to the UI elements which contains the label
this.setListAdapter(new ArrayAdapter<String>(this, R.layout.advertise,
R.id.label, names));
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
// Get the item that was clicked
Object o = this.getListAdapter().getItem(position);
String keyword = o.toString();
Toast.makeText(this, "You selected: " + keyword, Toast.LENGTH_LONG)
.show();
{
}
}
}
¿Sabes cómo iniciar una actividad? ¿Qué botón de retroceso? No muestra nada sobre un botón de retroceso. – Falmarri
No he agregado el código del botón de retroceso, lo siento. Está en el xml. Pero los he creado para mis pantallas normales. He estado usando Button sell = (Button) findViewById (R.id.sell); \t \t sell.setOnClickListener (nueva View.OnClickListener() { \t \t \t public void onClick (Ver vista) { \t \t \t \t Intención myIntent = new Intent (view.getContext(), Sell.class); \t \t \t \t startActivity (myIntent); – James