I need some help.I'm using this EnhanceListView for swipe to dismiss in my alertDialog but the swipe is not working. Does the swipe to dismiss doesn't work on alertdialog? or Am i missing something.? I tried setting the directions but still not working.
here is my code
public void viewDataList() {
LayoutInflater inflater = (LayoutInflater) this
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.alert_opendata, null);
lv = (EnhancedListView) view
.findViewById(R.id.data_list);
TextView emptyText = (TextView) view.findViewById(android.R.id.empty);
lv.setEmptyView(emptyText);
DisplayDataAdapter adapter = displayData();
lv.setAdapter(adapter);
lv.setDismissCallback(new OnDismissCallback() {
#Override
public Undoable onDismiss(EnhancedListView arg0, int arg1) {
// TODO Auto-generated method stub
return null;
}
});
lv.setSwipingLayout(R.id.swiping_layout);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setCancelable(false);
builder.setView(view);
builder.setNegativeButton("Close",
new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface dialog, int id) {
return;
}
});
builder.create().show();
}
my 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:orientation="vertical" >
<de.timroes.android.listview.EnhancedListView
android:id="#+id/data_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#C0C0C0"
android:minHeight="30dp" >
</de.timroes.android.listview.EnhancedListView>
<TextView
android:id="#android:id/empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="No Data"
android:textSize="20sp" />
</LinearLayout>
my List Item
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/swiping_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="2dp"
android:background="#F8f8f8"
android:orientation="vertical"
android:padding="5dp" >
<TextView
android:id="#+id/datalist_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#F8f8f8"
android:padding="10dp"
android:textSize="20sp" >
</TextView>
</LinearLayout>
i don't see you setting anywhere lv.enableSwipeToDismiss();
also, you may want to add stuff like:
lv.setUndoStyle(EnhancedListView.UndoStyle.MULTILEVEL_POPUP);
lv.setSwipeDirection(EnhancedListView.SwipeDirection.BOTH);
Related
I have problem with this case, how to detect event click on Relative Layout over ListView. Here my screenshot design:
This is my XML layout:
*<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<!-- HEADER -->
<LinearLayout
android:id="#+id/header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:id="#+id/edtsearch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/searchicon"
android:drawableRight="#drawable/deleteicon"
android:drawablePadding="3dp"
android:layout_weight="3"
android:hint="Item name"
android:padding="3dp"
android:windowSoftInputMode="stateVisible"
android:background="#layout/round_border_image"/>
</LinearLayout >
<!-- FOOTER -->
<LinearLayout
android:id="#+id/footer"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignParentBottom="true"
android:background="#b5b5b5">
</LinearLayout>
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/footer"
android:layout_below="#+id/header"
android:layout_weight="1" >
<ListView
android:id="#+id/lvcustomer"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:divider="#b5b5b5"
android:dividerHeight="1dp"
android:listSelector="#layout/custom_list_selector">
</ListView>
</FrameLayout>
<RelativeLayout
android:id="#+id/layoutadd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="15dp"
android:layout_marginBottom="15dp"
android:padding="8dp"
android:background="#607D8B">
<ImageView
android:id="#+id/btnadd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/addicon"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"/>
</RelativeLayout>
</RelativeLayout>*
And here my code:
**protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_view_customer);
Global.ViewCustomer=this;
final Typeface myTypeface = Typeface.createFromAsset(getAssets(), "fonts/pillgothic300mgregular-webfont.ttf");
getSupportActionBar().setDisplayShowHomeEnabled(false);
getSupportActionBar().setDisplayShowTitleEnabled(true);
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#d0d4d0")));
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeAsUpIndicator(R.drawable.backicon);
getSupportActionBar().setTitle("Back");
getSupportActionBar().setTitle((Html.fromHtml("<font color=\"#000\">Back</font>")));
LayoutInflater mInflater = LayoutInflater.from(this);
AdapterDb = new DataProcessor(this);
final SQLiteDatabase dbdelete = AdapterDb.getWritableDatabase();
final SQLiteDatabase dbinsert = AdapterDb.getWritableDatabase();
final SQLiteDatabase db = AdapterDb.getReadableDatabase();
try {
AdapterDb.importIfNotExist();
} catch (IOException e) {
e.printStackTrace();
}
final ListView lvcustomer=(ListView)findViewById(R.id.lvcustomer);
ArrayList<CustomerDetail_class> custlist = AdapterDb.getAllCustomer();
lvcustomer.setAdapter(new ListCustAdapter(getBaseContext(), custlist));
lvcustomer.setOnItemClickListener(new AdapterView.OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// TODO Auto-generated method stub
final CustomerDetail_class listcust = (CustomerDetail_class) parent.getItemAtPosition(position);
LayoutInflater li = LayoutInflater.from(ViewCustomer.this);
final View inputdialogcustom = li.inflate(R.layout.custom_user_default, null);
AlertDialog.Builder alert = new AlertDialog.Builder(ViewCustomer.this);
alert.setView(inputdialogcustom);
TextView tvuser = (TextView) inputdialogcustom.findViewById(R.id.tvuser);
tvuser.setTypeface(myTypeface);
tvuser.setTextSize(TypedValue.COMPLEX_UNIT_PX, getBaseContext().getResources().getDimensionPixelSize(R.dimen.lbltitlelistviewitem));
alert.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
}
});
alert.setNegativeButton("No", null);
alert.show();
}
});
RelativeLayout layoutadd=(RelativeLayout)findViewById(R.id.layoutadd);
layoutadd.bringToFront();
layoutadd.setClickable(true);
layoutadd.setEnabled(true);
layoutadd.setFocusable(true);
layoutadd.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Toast.makeText(getBaseContext(),"Halo",Toast.LENGTH_SHORT).show();
}
});
}**
already added event onclick on RelativeLayout, but it will raise listview click event, so do you have best solution for this case?
You can set clickable = true in the Relativelayout to make it work,
From the android doc:
android:clickable
Defines whether this view reacts to click events.
Must be a boolean value, either "true" or "false".
This may also be a reference to a resource (in the form
"#[package:]type:name") or theme attribute (in the form
"?[package:][type:]name") containing a value of this type.
This corresponds to the global attribute resource symbol clickable.
You can add transparent View over listView.
I want to let the user the possibility to delete the items shown in dropdown list of the spinner if clicks on the "X" button on the right side of each item, see the sample below.
If the user click on the item the Spinner should act like the classic Android default Spinner.
How should I extend and re-define the Spinner to work in this way?
I think you are looking for this:
MainActivity:
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
spnView3 = (Spinner) findViewById(R.id.spnView3);
ArrayList<String> aList = new ArrayList<String>();
aList.add("--Select--");
aList.add("Md. Shahadat Sarker");
aList.add("Developer");
aList.add("ErrrorPoint");
spnView3.setAdapter(new SpinnerAdapter(this, R.layout.spinner_row, aList, aList));
Toast.makeText(this, "Selected: " + spnView3.getSelectedItem(), 500).show();
}
activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<Spinner
android:id="#+id/spnView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left" />
</RelativeLayout>
spinner_row.xml (Layout):
<?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:baselineAligned="false"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="9"
android:orientation="horizontal" >
<TextView
android:id="#+id/spnItemName"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="9"
android:text="Item Name"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold" />
<TextView
android:id="#+id/spnItemDel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="X"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
</LinearLayout>
Adapter:
public View getCustomView(final int position, View convertView, ViewGroup parent){
LayoutInflater inflater = ((Activity) context).getLayoutInflater();
View rowView = inflater.inflate(R.layout.spinner_row, parent, false);
spnItemName = (TextView) rowView.findViewById(R.id.spnItemName);
spnItemDel = (TextView) rowView.findViewById(R.id.spnItemDel);
spnItemName.setText(iName.get(position)+"");
spnItemDel.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
Toast.makeText(context, "Deleted", Toast.LENGTH_SHORT).show();
//iName[position] = null;
iName.remove(position);
notifyDataSetChanged();
}
});
return rowView;
}
Full example is here... download
Edited Part:
if( /*Your condition goes here*/ ){
spnItemName.setVisibility(View.GONE);
} else{
spnItemName.setVisibility(View.VISIBLE);
}
I'm building a simple AlertDialog with custom layout from XML. Here is how it's supposed to look (taken from Eclipse): It's simply 4 columns:
Here is the xml of the image above:
<?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:orientation="horizontal"
android:weightSum="1.0" >
<ImageView
android:id="#+id/colorpicker_dialog_color1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:background="#FFF"
android:tag="0xFFF" />
<ImageView
android:id="#+id/colorpicker_dialog_color2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:background="#FFDD66"
android:tag="0xFFDD66" />
<ImageView
android:id="#+id/colorpicker_dialog_color3"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:background="#66CCFF"
android:tag="0x66CCFF" />
<ImageView
android:id="#+id/colorpicker_dialog_color4"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:background="#B6C0D2"
android:tag="0xB6C0D2" />
</LinearLayout>
Here is the code of the costume Alert Dialog:
public void showColorPickerDialog() {
LayoutInflater inflater = LayoutInflater.from(this);
View layout = inflater
.inflate(R.layout.color_picker_dialog, null);
ImageView clr1 = (ImageView) layout
.findViewById(R.id.colorpicker_dialog_color1);
clr1.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
// .. code
}
});
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("cccc");
builder.setView(layout)
.setCancelable(true)
.setPositiveButton("ok",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
}
}).show();
}
The problem is that in my dialog I dont see any column.
Try using Views instead of ImageViews in your layout. The problem using ImageViews in your case is that since you do not specify the src attribute for the ImageView, it will display a 0x0-sized image, which leaves your views invisible.
I created an xml file (a dialog) and I wanted to reduce it with LayoutInflater but its always big almost as my screen. Here's the code:
protected Dialog onCreateDialog(int id) {
switch(id) {
case NICKNAME_DIALOG_ID:
LayoutInflater inflater = (LayoutInflater)
getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View layout = inflater.inflate(R.layout.nickname_dialog,
(ViewGroup) findViewById(R.id.linearLayout_root));
final EditText nickname =
(EditText)findViewById(R.id.editText_nickname);
AlertDialog.Builder nicknameBuilder = new AlertDialog.Builder(this);
nicknameBuilder.setView(layout);
nicknameBuilder.setTitle(R.string.nicname_dialog_title);
nicknameBuilder.setNegativeButton(R.string.nickname_dialog_cancel,
new DialogInterface.OnClickListener() {
#SuppressWarnings("deprecation")
public void onClick(DialogInterface dialog, int whichButton) {
SettingsActivity.this.removeDialog(NICKNAME_DIALOG_ID);
}
});
nicknameBuilder.setPositiveButton(R.string.nickname_dialog_ok,
new DialogInterface.OnClickListener() {
#SuppressWarnings("deprecation")
public void onClick(DialogInterface dialog, int which) {
String text = nickname.getText().toString();
Editor editor = m_GameSettings.edit();
editor.putString(VolimHrvatsku.GAME_PREFERENCES_NICKNAME,
text);
editor.commit();
SettingsActivity.this.removeDialog(NICKNAME_DIALOG_ID);
}
});
AlertDialog nicknameDialog = nicknameBuilder.create();
return nicknameDialog;
}
return null;
}
nickname dialog xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/linearLayout_root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/sahovnica"
android:orientation="vertical" >
<TextView
android:id="#+id/textView_enter_nickname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/settings_enter_nick"
android:textColor="#color/dark_grey"
android:textSize="#dimen/scores_text_dim"
android:textStyle="bold" />
<EditText
android:id="#+id/editText_nickname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" >
<requestFocus />
</EditText>
<RelativeLayout
android:id="#+id/relativeLayout_nickname"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</RelativeLayout>
</LinearLayout>
email dialog xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/linearLayout_email"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/sahovnica"
android:orientation="vertical" >
<TextView
android:id="#+id/textView_body"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/email_dialog_text"
android:textColor="#color/dark_grey"
android:textSize="#dimen/scores_text_dim"
android:textStyle="bold" />
<EditText
android:id="#+id/editText_body"
android:layout_width="match_parent"
android:layout_height="150dp"
android:ems="10" >
<requestFocus />
</EditText>
<RelativeLayout
android:id="#+id/relativeLayout_email"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</RelativeLayout>
</LinearLayout>
And I would like to ask btw, if it is possible to change the look of YES and NO buttons in AlertDialog?
Thanks in advance...
In emaildialog.xml do the layout width and height wrap_content
I think so, this might help you.
I'm trying to get a custom Dialog to work. It should have no Title, a basic TextMessage and my Custom Layout where normally Buttons appear.
I tried to accomplish this with an AlertDialog.Builder, extending Dialog, call methods on the Dialog and still not get the expected result.
This is the layout, I Like to use as a custom ButtonArea (layout/dialog_footer):
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<CheckBox
android:id="#+id/dialog_checkbox"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/never_show_again"
android:textColor="#color/black"
android:visibility="gone"
android:background="#color/dialog_button_background"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/dialog_checkbox"
android:layout_alignWithParentIfMissing="true"
android:orientation="horizontal"
android:background="#color/dialog_button_background"
android:paddingBottom="-10dip">
<Button
android:id="#+id/dialog_btn_positive"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:text="#string/ok"
android:gravity="center"
android:visibility="gone"
/>
<Button
android:id="#+id/dialog_btn_negative"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:text="#string/btn_cancel"
android:visibility="gone" />
</LinearLayout>
</RelativeLayout>
The simplest try goes like this:
AlertDialog.Buiilder builder = new AlertDialog.Builder(context);
builder.setMessage("my Message");
Dialog dialog = builder.create();
//builder has `setView for Message or setCustomTitle, but no setCustomFooter
LayoutInflater inflater = LayoutInflater.from(context);
View footer = inflater.inflate(R.layout.dialog_footer);
//either NullPointer Exception
dialog.addContentView(footer, footer.getLayoutParams);
//or AndroidRuntimeException (requestFeature() must be called befoire adding content)
dialog.addContentView(footer, new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
If I try to emulate the "MessageArea" by putting a TextView on Top of my Layout it works, but has very ugly black borders at the bottom (I guess its the custom Dialog-Theme).
Whats the best way to keep the "look and feel" of a System Dialog, but replace the Buttons with my own View and handle anything myself?
Hello friend please check this post it may be helpful for your problem
Android - Custom AlertDialog Background Color
Here which i have build my own Custom Edit Dialog for my app see the Layout code
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TableRow>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="Name: "
android:textColor="#fff" />
<EditText
android:id="#+id/txtDelName"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp" />
</TableRow>
<TableRow>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="Contact No :"
android:textColor="#fff" />
<EditText
android:id="#+id/txtDelAge"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:ems="10" >
<requestFocus />
</EditText>
</TableRow>
<TableRow android:layout_height="wrap_content" >
<Spinner
android:id="#+id/spinDiagDept"
android:layout_width="150dp"
android:layout_height="50dp"
android:layout_marginLeft="5dp"
android:layout_span="2"
android:prompt="#string/Rel_prompt"
android:visibility="visible" />
</TableRow>
</TableLayout>
And here is the alert dialog code
public class Alerts {
public static AlertDialog ShowEditDialog(final Context con,final Emergencydb emp)
{
AlertDialog.Builder b=new AlertDialog.Builder(con);
b.setTitle("Emergency Contact Details");
LayoutInflater li=LayoutInflater.from(con);
View v=li.inflate(R.layout.editdialog, null);
b.setIcon(android.R.drawable.ic_input_get);
b.setView(v);
final TextView txtName=(TextView)v.findViewById(R.id.txtDelName);
final TextView txtAge=(TextView)v.findViewById(R.id.txtDelAge);
final Spinner spin=(Spinner)v.findViewById(R.id.spinDiagDept);
Utilities.ManageDeptSpinner(con, spin);
for(int i=0;i<spin.getCount();i++)
{
long id=spin.getItemIdAtPosition(i);
if(id==emp.getDept())
{
spin.setSelection(i, true);
break;
}
}
txtName.setText(emp.getName());
txtAge.setText(String.valueOf(emp.getAge()));
b.setPositiveButton("Modify", new OnClickListener() {
#Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
emp.setName(txtName.getText().toString());
emp.setAge(String.valueOf(txtAge.getText().toString())); emp.setDept((int)spin.getItemIdAtPosition(spin.getSelectedItemPosition()));
try
{
#SuppressWarnings("rawtypes")
DatabaseHelper db=new DatabaseHelper(con);
db.UpdateEmp(emp);
Toast.makeText(getBaseContext(), "Modified Successfully", Toast.LENGTH_SHORT).show();
}
catch(Exception ex)
{
}
}
});
b.setNeutralButton("Delete", new OnClickListener() {
#Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
#SuppressWarnings("rawtypes")
DatabaseHelper db=new DatabaseHelper(con);
db.DeleteEmp(emp);
}
});
b.setNegativeButton("Cancel", null);
return b.create();
//diag.show();
}
protected static Context getBaseContext() {
// TODO Auto-generated method stub
return null;
}
public static void ShowEmpAddedAlert(
android.view.View.OnClickListener onClickListener) {
// TODO Auto-generated method stub
}
}
with the help of Aleks G I managed to get it work:
the code flow goes like this:
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setMessage("MyMessage");
LayoutInflater inflater = LayoutInflater.from(context);
View footerView = inflater.inflate(R.layout.apo_plus_dialog_footer, null);
AlertDialog alertDialog = builder.create();
alertDialog.setView(footerView, 0,0,0,0);
if (!hasTitle){
alertDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
}
alertDialog.show();
just in case someone wants to have a similar Dialog behavior than me.