۱۳۹۴/۰۹/۱۶, ۰۹:۰۳ ب.ظ
من سورس قسمت لوگین یکی از برنامه هایخودم میزارم دیگ ایدیتش با خودت
این کد ها باید بعد از کلیک شدن به دکمه وارد کنی که کد های دیالوگ هستش
کد های xml دیالوگ
این کد ها باید بعد از کلیک شدن به دکمه وارد کنی که کد های دیالوگ هستش
کد:
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 دیالوگ
کد پیاچپی:
<?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>
همه آدما برای رسیدن به جایی که هستند از تجربه دیگران استفاده کردند
پس چرا ما از اندک تجربه ای که داریم برای راهنمایی دیگران استفاده نکنیم؟؟
پس چرا ما از اندک تجربه ای که داریم برای راهنمایی دیگران استفاده نکنیم؟؟