Coder Social home page Coder Social logo

Comments (3)

GeraldR63 avatar GeraldR63 commented on September 28, 2024

The fault was in my code.
I instantiated the printSightRedcution inside a push button on click event. Since the whole printjob is asynchronous and works independent from the AstroNavigator app it was required to have this class instantiated in a class where it longer exists. The point is that the message in the Status field in the "Nautical Almanac" dialog appear before the "Printer Dialog" and preview was loaded but after that the code is at the end and the block will be destroyed. The garbage collector will clean up the instantiated object more or less fast.

That's why I moved the bold line of code out of the "setOnClickListener". Now it seems to be much more stable.

===========================Code snippet Begin
printSightRedcution = new printSightRedcution(NADataAndCalc);
pbPrintSightReductionForm.setOnClickListener(new View.OnClickListener() {
@OverRide
public void onClick(View view) {
// ToDo: Print the Sight Reduction
try {
if (NADataAndCalc!=null) {
// Moved outside the event handler printSightRedcution = new printSightRedcution(NADataAndCalc);
printSightRedcution.doWebViewPrint(getActivity());
// Function above come back before preview was shown or SRF was printed. The app run in the background.
// This change made it much more stable.
mdfStatus.setBackgroundColor(Color.WHITE);
mdfStatus.setText("Printing Sight Reduction Form");
}
else {
mdfStatus.setBackgroundColor(Color.WHITE);
mdfStatus.setText("No printable calculation");
}
}
catch (Exception e)
{
mdfStatus.setBackgroundColor(Color.RED);
mdfStatus.setText(e.getMessage());
}
}
});
===========================Code snippet End

from astronavi.

GeraldR63 avatar GeraldR63 commented on September 28, 2024

In the emulator it works perfect. Seem to be really a problem of the Epson driver. Especially under heavy CPU load this problem was seen.

from astronavi.

GeraldR63 avatar GeraldR63 commented on September 28, 2024

Additional Remark: In emulation mode this works also perfect. In my opinion just a problem of the CPU power of the cellphone.

from astronavi.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.