Je pense que j'ai besoin d'un écouteur, mais je ne peux pas le configurer. Dans le code ci-dessous, le dialogue de temps et le dialogue de date fonctionnent. Le petit dialogue w/rollers arrive, je sélectionne une date/heure, puis sélectionne et j'ai ma date. Mais je ne peux pas obtenir la saisie de texte pour fonctionner. J'ai essayé plusieurs itérations de ce code à partir d'un exemple de programme qui avait: bnBodyEntered = true; bodyDialog = nouveau TextInputDialog (this); bodyDialog.setText ("body"); Ce code affichait le dialogue de texte avec le rouleau de l'alphabet, mais le programme l'a dépassé et lorsque j'ai entré quelques lettres et que rien ne s'est passé. Cela fait depuis que je n'ai pas mis en place un auditeur. J'ai donc ajouté (comme indiqué) bodyDialog.setOnDismissListener (textSetListener); en utilisant plusieurs valeurs "setOn ---- Listener" et Il soit encore en cours d'exécution, ou je reçois diverses erreurs de compilation.Comment configurer un écouteur?
Ceci est pour ma montre WIMMOne, donc la version 7 et pas de clavier virtuel. Cela doit être un dialogue.
(Note: Je supprimé gobs de code commenté avant de poster - peut-être quelque chose de plus, donc si elle ne fait pas depuis - désolé.)
Merci, Clark
/******************************
* Wimm imports
******************************/
import com.wimm.framework.app.Dialog;
import com.wimm.framework.app.DatePickerDialog;
import com.wimm.framework.app.DatePickerDialog.OnDateSelectedListener;
import com.wimm.framework.app.LauncherActivity;
import com.wimm.framework.app.TextInputDialog;
import com.wimm.framework.app.TimePickerDialog;
import com.wimm.framework.app.TimePickerDialog.OnTimeSelectedListener;
@ Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
Log.d("RemindEA","01S onCrt");
setContentView(R.layout.reminder_edit_activity);
. . .
. . .
mBodyText = (EditText)findViewById(R.id.body);
mTimeButton = (Button)findViewById(R.id.reminder_time);
mDateButton = (Button)findViewById(R.id.reminder_date);
mConfirmButton = (Button)findViewById(R.id.confirm);
Log.d("RemindEA","10S onCrtV df");
//------------- TEXT INPUT
mBodyText.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
Log.d("RemindEA","21> onClkV:Body");
showDialog(BODY_DIALOG_ID);
Log.d("RemindEA","22< onClkV:Body:" + strBody);
mBodyText.setText(bodyDialog.getText());
return;
}
});
//-------------------------- TIME INPUT
mTimeButton.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
Log.d("RemindEA","25> onClkV:Time");
showDialog(TIME_DIALOG_ID);
Log.d("RemindEA","26< onClkV:Time");
}
});
//-------------------------- DATE INPUT
mDateButton.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
Log.d("RemindEA","30> onClkV:Time");
showDialog(DATE_DIALOG_ID);
Log.d("RemindEA","31< onClkV:Time");
}
} );
protected Dialog onCreateDialog(int id)
{
Log.d("RemindEA","70S Dialog:" + id);
switch (id)
{
// if we want a time dialog--------------
case TIME_DIALOG_ID:
Log.d("RemindEA","71S TIME_DIALOG_ID");
timeDialog = new TimePickerDialog(this);
timeDialog.setTimeSelectedListener(timeSetListener);
timeDialog.setTime(mCalendar.get(Calendar.HOUR_OF_DAY),
mCalendar.get(Calendar.MINUTE));
Log.d("RemindEA","73S TIME_D:" + timeDialog);
return timeDialog;
// if we want a date dialog ---------------
case DATE_DIALOG_ID:
Log.d("RemindEA","75S DATE_DIALOG_ID-26");
mCalendar = Calendar.getInstance();
Log.d("RemindEA","76S DATE_DIALOG_ID-27");
dateDialog = new DatePickerDialog(this);
dateDialog.setDateSelectedListener(dateSetListener);
dateDialog.setDate(mCalendar.get(Calendar.DAY_OF_MONTH),
mCalendar.get(Calendar.MONTH ));
Log.d("RemindEA","77S DATE_D:" + dateDialog);
return dateDialog;
// if we want text input dialog ---------------------
case BODY_DIALOG_ID:
Log.d("RemindEA","80S BODY_DIALOG_ID");
bnBodyEntered = true;
Log.d("RemindEA","81S TITLE");
bodyDialog = new TextInputDialog(this);
//---> ADDED LINE BELOW TO CREATE A LISTENER: GET ERROR <-----
// ERROR BELOW: setOnDismissListener cannot be resolved to a type
bodyDialog.setOnDismissListener(textSetListener);
//------------------------------------------
//ALSO //.setOnKeyListener(onKeyListener) - others
Log.d("RemindEA","82S New");
bodyDialog.setText("body");
Log.d("RemindEA","83X:" + bodyDialog);
return bodyDialog;
}
return null;
}
private OnTimeSelectedListener timeSetListener = new OnTimeSelectedListener()
{
public void onTimeSelected(int arg0, int arg1)
{
Log.d("RemindEA","90S onTimeSelected");
intHH = arg0;
intMN = arg1;
Log.d("RemindEA","91S schedule:" + intHH + ":" + intMN);
//updateDisplay();
}
};
private OnDateSelectedListener dateSetListener = new OnDateSelectedListener()
{
public void onDateSelected(int arg0, int arg1)
{
Log.d("RemindEA","92S onTimeSelected");
intDD = arg0;
intMM = arg1;
Log.d("RemindEA","93S schedule:" + intDD + ":" + intMM);
//updateDisplay();
}
};
//------------------------------------
// -----> ERROR: setOnDismissListener cannot be resolved to a type
private setOnDismissListener textSetListener = new setOnDismissListener
//------------------------------------
{
private void textSetListener() // bodySetListener()
{
Log.d("RemindEA","100S BodyLisner"); //<- does not get here on <done>
return;
}
};