I have a set of activities in an application, where most of the activities has a common image. I want that after clicking on the image a dialog box will open and do some task as switching to another activity. This will be same for all the activities. But it is showing some error. Please help me resolve this
Here is the activity's onclick event
ImageView imgMenu = (ImageView) findViewById(R.id.imgMenu);
imgMenu.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = FeatureMenu.ShowMenu(getApplicationContext());
if (intent != null) {
startActivity(intent);
}
}
});
And this is a static class to handle the common functions:
public class FeatureMenu {
public static Intent intent;
public static Intent ShowMenu(final Context mcontext) {
Dialog d = new Dialog(mcontext);
d.requestWindowFeature(Window.FEATURE_NO_TITLE);
d.setContentView(R.layout.menu_layout);
ImageView abc = (ImageView) d
.findViewById(R.id.abc);
abc.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
intent=new Intent(mcontext,
xyz.class);
}
});
d.show();
return intent;
}
}