XML code (pedir_tel.xml)
Using xml Syntax Highlighting
- <EditText xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/tel_envio"
- android:textSize="12px"
- android:textColor="#000"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:gravity="center_vertical"
- android:padding="5sp"
- />
Parsed in 0.001 seconds, using GeSHi 1.0.8.4
JAVA code:
Using java Syntax Highlighting
- public class Tel_Request extends Activity
- {
- private static final int DIALOG_TEXT_ENTRY = 7;
- private EditText numero_tel;
- @Override
- protected Dialog onCreateDialog(int id)
- {
- if (id == DIALOG_TEXT_ENTRY)
- {
- LayoutInflater factory = LayoutInflater.from(this);
- final View textEntryView = factory.inflate(R.layout.pedir_tel, null);
- return new AlertDialog.Builder(Tel_Request.this)
- .setTitle("Ingresar número telefónico")
- .setView(textEntryView)
- .setPositiveButton("Enviar", new DialogInterface.OnClickListener()
- {
- public void onClick(DialogInterface dialog, int whichButton)
- {
- numero_tel = (EditText) textEntryView.findViewById(R.id.tel_envio);
- String tele = numero_tel.toString();
- if ( tele != null)
- mostrar(tele);
- else
- mostrar ("hello world");
- }
- })
- .setNegativeButton("Cancelar", new DialogInterface.OnClickListener()
- {
- public void onClick(DialogInterface dialog, int whichButton)
- {
- setResult(RESULT_OK);
- finish();
- }
- })
- .create();
- }
- return null;
- }
- @Override
- protected void onCreate(Bundle savedInstanceState)
- {
- super.onCreate(savedInstanceState);
- showDialog(DIALOG_TEXT_ENTRY);
- }
- private void mostrar(String s)
- {
- Toast toast = Toast.makeText(this, s, Toast.LENGTH_LONG);
- toast.show();
- }
- }
Parsed in 0.039 seconds, using GeSHi 1.0.8.4
The curious fact is that in the toast message doesn't show the "hello world" message, it shows "Android.widget.EditText@4343fa80" (the number varies). I will be very thankful to the person that could help me becausa I been all day long trying to fix this.
Regards,
Helios


