setText öğesinde bir hataya neden oluyor. Id Verilen değer doğru ise, eğer sanal yöntem 'void android.widget.EditText.setText (java.lang.CharSequence)' nu null bir nesne başvurusu üzerinde çalıştırmaya teşebbüs ettiysemBoş işaretçiye neden Özel Durum
Burada verilen kod AyarıText Otp Kodu " otpcode.setText ("12345");" oncreate içinde mükemmel çalışır. "recivedSms" yönteminde verdiğimde. Işe yaramadı. Eğer setText gibi boş işaretçi istisna verecektir sonra EditText için smsnumbr ayarlamak çalışıyorsanız
public class Change_Password_Activity extends AppCompatActivity {
EditText user_name,pass_wd;
public EditText otpcode;
private Button btn_submit;
private String username,otp,password;
private ProgressDialog prgDialog;
private Typeface typeface;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_change__password_);
typeface = GlobalVariables.getTypeface(Change_Password_Activity.this);
prgDialog = new ProgressDialog(this);
// Set Progress Dialog Text
prgDialog.setMessage("Please wait...");
// Set Cancelable as False
prgDialog.setCancelable(false);
otpcode = (EditText)findViewById(R.id.otpedittext);
user_name = (EditText) findViewById(R.id.edittext_ch_user);
pass_wd = (EditText) findViewById(R.id.edittext_ch_passwd);
btn_submit = (Button) findViewById(R.id.button_changepswd);
otpcode.setTypeface(typeface);
user_name.setTypeface(typeface);
pass_wd.setTypeface(typeface);
btn_submit.setTypeface(typeface);
}
public void recivedSms(String message)
{
try
{
int smsnumbr= Integer.parseInt(message);
otpcode.setText(smsnumbr);
}
catch (Exception e)
{
Log.e("error", String.valueOf(e));
}
onCreate her zaman önce çağrıldı onSms? –
Ne zaman ve nerede alınır? – zgc7009
sms yöntemi alındı onCreate'dan sonra çağrı – susaine