I would like to know if it is possible to check the connectivity in android without Context, because the thread that is running in my background does not know the context. if there is no way, is it best practice to pass context to the thread?
thank
Yes you need Context. Perhaps your thread will already have access to the Contextkindly provided Runnablethat it uses as an inner class Activityor Servicethat forked the thread.
Context
Runnable
Activity
Service
Your runnable Object will be launched inside an Activity or Service so that it has access to its methods.
, :
OuterClassName.this.getContext();
Source: https://habr.com/ru/post/1732919/More articles:C ++ - What libraries or command line programs will I need to create a program that takes an AVI file and burns it to a DVD? - c ++How can I make a rich web application in Perl? - user-interfaceThe class name for the unix-like permission object is javaHow to copy an object that is inherited from an im object trying to copy? - c #Is there any need to use WS2_32.dll instead of wsock32.dll when creating using MSVC9.0 - visual-c ++WPF: ะะฐะบ ะฟะพะผะตััะธัั ะบัััะพั ะผััะธ ะฒ ะบะพะด? - wpfMoving between coordinates, Java Algorithms - javaWPF: How to animate the list of components? - user-interfaceOptimal Tracking - mapHow to create a BlackBerry application for access to low-level equipment? - mobileAll Articles