۱۳۹۴/۰۹/۱۶, ۰۴:۱۰ ب.ظ
سلام دوستان من یک دکمه دارم که وقتی روش کلیک میکنیم یه اویت تکست باز شه کارش هم رمز عبور هست و من میخوام بدونم مثلا کسی برای دومین بار برنامه شده رمز عبور رو باهم مقایسه کنه اگه یکی بود رد شه
مرسی
مرسی
final Dialog dialog = new Dialog(this);
dialog.setContentView(R.layout.pagelockapp);
dialog.setTitle("رمز ورود");
// set the custom dialog components - text, image and button
ed1 = (EditText)dialog.findViewById(R.id.editText1);
Button dialogButton = (Button) dialog.findViewById(R.id.button1);
//if button is clicked, close the custom dialog
dialogButton.setOnClickListener(new OnClickListener() {
private String mehdireyhan;
@Override
public void onClick(View v) {
SharedPreferences sh2 = getSharedPreferences("Prefsdata", MODE_PRIVATE);
SharedPreferences.Editor editorco2 = sh2.edit();
mehdireyhan = sh2.getString("passw1", "");
if (mehdireyhan.equals(ed1.getText().toString())) {
showCustomAlert();
Intent sajad3 = new Intent(PageMenu.this ,AnbarAsli .class);
startActivity(sajad3);
dialog.dismiss();
}else {
Toast.makeText(getApplication(), "رمز ورود صحیح نیست...", 4000).show();
dialog.dismiss();
}
}
});
dialog.show();
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/backsetting"
android:orientation="vertical" >
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/editname"
android:ems="10"
android:inputType="number" >
<requestFocus />
</EditText>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/btnsetting"
android:text="ورود" />
</LinearLayout>