I am trying to insert images to linearlayout which is inside the dialog.But while running the application i get nullpointer exception error. I want to know how to get the object of view inside dialog.
Here is my code inside oncreate function.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_compinfo);
dialog = new Dialog(this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.activity_compinfopopup);
dialog.getWindow().getAttributes().width = AbsListView.LayoutParams.MATCH_PARENT;
dialog.getWindow().getAttributes().height = AbsListView.LayoutParams.WRAP_CONTENT;
dialog.show();
myGallery = (LinearLayout) findViewById(R.id.mygallery);
myGallery.addView(insertPhoto("http://www.a.com/demos/img/home/01.jpg"));
myGallery.addView(insertPhoto("http://www.a.com/demos/img/home/02.jpg"));
myGallery.addView(insertPhoto("http://www.a.com/demos/img/home/02.jpg"));
myGallery.addView(insertPhoto("http://www.a.com/demos/img/home/02.jpg"));
}
Please help