PDA

View Full Version : custom alert dialog



مرسدس20
چهارشنبه 27 اردیبهشت 1391, 16:43 عصر
سلام خواهشن یکی جواب بده کسی می دونه چطور متنم رو از edit text که توی alert dialog است بگیرم و بریزم توی data base

hooman.ahmadi
دوشنبه 01 خرداد 1391, 01:10 صبح
سلام
این یک نمونه کد برای بازیابی اطلاعات از alert dialog است
AlertDialog.Builder builder;
AlertDialog alertDialog;


Context mContext = getApplicationContext();
LayoutInflater inflater = (LayoutInflater) Context.getSystemService(LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.custom_dialog,
(ViewGroup) findViewById(R.id.layout_root));

TextView text = (TextView) layout.findViewById(R.id.text);
text.setText("Hello, this is a custom dialog!");
ImageView image = (ImageView) layout.findViewById(R.id.image);
image.setImageResource(R.drawable.android);

builder = new AlertDialog.Builder(mContext);
builder.setView(layout);
alertDialog = builder.create();