I'm trying to start a background service from a pop-up dialog and it's just doesn't work for me
this is the code for opening the dialog box:
reportWrongLang.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
FragmentManager fm = getFragmentManager();
ReportWrongLangDialog Dialog = new ReportWrongLangDialog(imageInfo.getParam("imageId")[0], getApplicationContext());
Dialog.show(fm, "are_you_sure_dialog");
}
in the ReportWrongLangDialog i am saving the appContext, and the imageId
and in the dialog when pressing the report button I want to start the background service that will report about the image
the code for the onClick
report.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
System.out.println("got imageid: " + imageId);
Intent intent = new Intent(appContext, ReportImageService.class);
intent.putExtra("ReportType", "IMAGE_REPORT");
intent.putExtra("ImageID", imageId);
intent.putExtra("Extra", "2");
appContext.startService(intent);
System.out.println("after service start");
}
});
where ReportImageService.class is the service that I want to start. when i'm pressing the report button nothing happens..
what can be the problem? I can only assume that there is some problem with the applicationContext