Ver Mensaje Individual
  #1 (permalink)  
Antiguo 16/03/2014, 09:44
Avatar de JairLizcano
JairLizcano
 
Fecha de Ingreso: junio-2008
Ubicación: Santander, Colombia
Mensajes: 608
Antigüedad: 15 años, 11 meses
Puntos: 53
Pregunta Diferente Layout

Cree un layout con las siguientes características:

Código HTML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    
    <TextView
        android:id="@+id/amount_rooms"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="@string/rooms_placeholder"/>
    
    <EditText
	        android:id="@+id/iamount_rooms"
	        android:layout_width="match_parent"
	        android:layout_height="wrap_content"
	        android:ems="1"
	        android:hint="@string/rooms_default"
	        android:paddingLeft="15dp"
	        android:inputType="number" 
	    />
    
    <TextView
        android:id="@+id/amount_baths"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="@string/baths_placeholder" />
    
    <EditText
	        android:id="@+id/in_amount_baths"
	        android:layout_width="match_parent"
	        android:layout_height="wrap_content"
	        android:ems="1"
	        android:hint="@string/baths_default"
	        android:paddingLeft="15dp"
	        android:inputType="number" 
	    />
</LinearLayout> 
Lo ubiqué adentro de la carpeta layout donde también tengo el activity_main.xml que es el principal, el problema nace cuando intento acceder a un campo de texto del nuevo layout desde el activity principal:

Código:
TextView rooms = (TextView) findViewById(R.id.iamount_rooms);
    		
    		Toast toast;
		   	toast = Toast.makeText(getApplicationContext(), rooms.getText(), Toast.LENGTH_LONG);
			toast.show();
Sencillamente no me muestra nada...

¿Alguna sugerencia? No sé si deba especificar a la clase R de que hay un nuevo layout o algo así, ya que con el activity_main.xml no hay problema.

Desde ya muchas gracias.
__________________
Programar dejó de ser una profesión acusada en la oscuridad y disfrutada fríamente... para convertirse en un arte.