B4X FEED Workaround the NetworkOnMainThread exception

اطلاعات موضوع

درباره موضوع در تاریخ, در دسته b4xfeed ایجاد شده و آغاز کننده آن practicalsoftمی باشد و موضوع آن: Workaround the NetworkOnMainThread exception است. این موضوع تا کنون 41 بازدید کننده و, 0 پاسخ داشته و 0 بار پسندیده شده...
نام دسته b4xfeed
نام موضوع Workaround the NetworkOnMainThread exception
آغاز کننده موضوع practicalsoft
تاریخ شروع
پاسخ‌ها
0
بازدیدها
41
پسندها
0
آخرین ارسال توسط PracticalSoft
Jun 6, 2020
11,517
4,383
Android 4+ doesn't allow applications to make network calls on the main thread. There is a good reason for this restriction as such calls cause the UI to freeze and after 5 second Android will show the "Application not responding" dialog.

Proper libraries take care of handling network calls with background threads. If you encounter a library that doesn't do it then you have two options:

1. Use the Threading library to start a background thread and make the calls from this thread.
2. Disable this check.

The code posted here disables this check (it only calls public APIs and is safe to use):
B4X:

کد:
محتوای بلوک کدها در دسترس شما نیست. برای مشاهده بلوک کدها، وارد انجمن شوید یاثبت نام کنید



 

عقب
بالا