Hi,
I use Alert Dialog as Login. So after closing this dialog, any value assigned at dialog show() is lost. how to get back this value? my code is below
private void accessPinCode()
{
LayoutInflater factory = LayoutInflater.from(this);
final View textEntryView = factory.inflate(R.layout.dialog_login, null);
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle("Title");
alert.setMessage("Enter Pin :");
alert.setView(textEntryView);
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
EditText mUserText;
mUserText = (EditText) textEntryView.findViewById(R.id.txt_password);
//String strPinCode = mUserText.getText().toString();
Log.d( TAG, "Pin Value 1 : " + mUserText.getText().toString());
strPIN = mUserText.getText().toString();
Log.d( TAG, "strPIN inside accessPinCode : " + strPIN);
fPIN= checkPINCode();
Log.d( TAG, "fPass : " + fPIN);
return;
}
});
alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
return;
}
});
alert.show();
Log.d( TAG, "strPIN outside Alert Show : " + strPIN);
}
Based on my code, strPIN and FPIN values are lost. I wanna use those value outside accessPinCode function. how to get?
Actually, I call this function at tabchanged event. If login pass, the user could access another tab. But all've already worked in tab changed event before clicking AlertDialog's Ok button. My tab event like below
tabHost.setOnTabChangedListener(new OnTabChangeListener() {
public void onTabChanged(String tabId) {
// TODO Auto-generated method stub
if (tabId.equals("index"))
{
tabHost.setCurrentTab(1);
accessPinCode();
}
Log.d( TAG, "tabId : "+ tabId );
}
});
Is there any type of Dialog suitable for Login? How to solve?
Thank you.