Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App is blocking the UI and crashing in android 6.0 and below #51

Open
nikhilgarg89 opened this issue Oct 9, 2018 · 7 comments
Open
Labels

Comments

@nikhilgarg89
Copy link

App is blocking the UI and crashing in android 6.0 and below when i am doing subnet devices. this is reproducible in sample code.

@nikhilgarg89
Copy link
Author

@stealthcopter any workaround possible.. ??

@nikhilgarg89
Copy link
Author

@stealthcopter your help is appreciated

1 similar comment
@nikhilgarg89
Copy link
Author

@stealthcopter your help is appreciated

@lcabrales
Copy link

lcabrales commented Apr 16, 2019

@nikhilgarg89 Use the following method to run on the Ui thread inside onFinished or in onDeviceFound

@Override
public void onFinished(ArrayList<Device> devicesFound) {
    final List<Device> devices = devicesFound; //to be referenced inside the Handler
   
    //run on UI thread
    new Handler(Looper.getMainLooper()).post(new Runnable() {
        @Override
        public void run() {
            //todo manipulate UI
        }
    });
}

@jerrychong25
Copy link

jerrychong25 commented Sep 9, 2019

@lcabrales I have tried your solution by adding new Handler into my PortScan() function, however it still blocked my Progress Dialog and hang.

Is there any ways to prevent this blocking of Progress Dialog?

You may refer more details of my issues here: #58

Thanks.

@jerrychong25
Copy link

@lcabrales @nikhilgarg89

Any clues on solving this issue?

Thanks.

@stealthcopter
Copy link
Owner

stealthcopter commented Nov 3, 2019

I've just tested the sample app on android 6.0 and I'm not having any UI blocking issues. What device are you using? Try lowering the thread count in case your device is using maximum CPU and causing an actual hang.

@jerrychong25 please post your full example with ProgressDialog and I'll run some tests on it to find out what's going on.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants