Bot Bahlul
Bot Bahlul

Reputation: 11

com.chaquo.python.PyException: NotImplementedError: com.chaquo.python.PyProxy._chaquopyGetDict is abstract and cannot be called

I'm using 'class R(dynamic_proxy(Runnable)):' to modify textview component of my app UI

def pBar(count_value, total, prefix, activity, textView_debug):
    bar_length = 10
    filled_up_Length = int(round(bar_length*count_value/(total)))
    percentage = round(100.0 * count_value/(total),1)
    bar = '#' * filled_up_Length + '=' * (bar_length - filled_up_Length)
    if (int(percentage) % 10 == 0):
        class R(dynamic_proxy(Runnable)):
            def run(self):
                #time.sleep(1)
                textView_debug.setText('%s [%s] %s%s\r' %(prefix, bar, percentage, '%'))
        activity.runOnUiThread(R())

The problem is if this 'activity.runOnUiThread(R())' BEING CALLED TO FAST REPEATLY it will make my app crashed randomly with above error messages (if the 'total' value is quietly small it will run fine, but if that 'total' value is big it will crashed).

I've tried to add 'time.sleep(1)' and 'if (int(percentage) % 10 == 0)' to slowing down the call, but still got the issue

Is there any better way to UPDATE TEXTVIEW without having this issue? Please give me some guidance.

My app repo is https://github.com/botbahlul/android-autosrt in case you need to check it.

TIA

Upvotes: 1

Views: 64

Answers (0)

Related Questions