My application contains many Dialog windows. It has gotten to the point that the source seems overwhelming. I am looking for opinions about the best way to segregate Dialog source. I am relatively new to Java, so I am assuming that I can put them in a separate class. However, the exact way to do this in Android alludes me. May someone point me in the right direction?
Share
u can create dialogue by extending dialogue as follows
1. Create a Layout.xml for customDialog
Create a new layout which contains the view. in this example i have used edittext and button.
Create a Custom Dialog Class.
a. Create a class extends the dialog class
b. Create a Event Handler Interface as a member
c. Use the custom layout in onCreate Method.
}
Create a MainActivity and Implement the CustomDialog
public class MainActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
MyCustomDialog myDialog = new MyCustomDialog(this, “”,
new OnReadyListener());
myDialog.show();
}
private class OnReadyListener implements MyCustomDialog.ReadyListener {
@Override
public void ready(String name) {
Toast.makeText(MainActivity.this, name, Toast.LENGTH_LONG).show();
}
}
}