Create Custom Dialog in Android

Creating a custom dialog by using the method setContentView(viewtype). To use this function you have to create a reference variable for Dialog class object as i have done below

Dialog dialog=new Dialog(Context);
LayoutInflater inflater = LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v1=inflater.inflate(R.layout.yourlayout, null);
//perform operation on elements in Layout
dialog.setContentView(v1);
dialog.show();
//For getting the elements in the layout you have to use the findViewById on the View v1.

//Just like this and perform whatever function you have to perform on click of the button. So isn't it simple.
Button button=v1.findViewById(R.id.buttonid);

Getting IP address of the android device visit this link


Comments

Popular posts from this blog

Making Bootable Pendrive with .bat file

Ek Beej Tha Gaya Bahut Hee Gaharaee Mein Boya - Nanha Paudha

R-W-W (Real, Win, Worth it ) - Boost your idea