Android Guides | Samples

Android.OS.NetworkOnMainThreadException Class

The exception that is thrown when an application attempts to perform a networking operation on its main thread.

See Also: NetworkOnMainThreadException

Syntax

[Android.Runtime.Register("android/os/NetworkOnMainThreadException", DoNotGenerateAcw=true)]
public class NetworkOnMainThreadException : RuntimeException

Remarks

The exception that is thrown when an application attempts to perform a networking operation on its main thread.

This is only thrown for applications targeting the Honeycomb SDK or higher. Applications targeting earlier SDK versions are allowed to do networking on their main event loop threads, but it's heavily discouraged. See the document Designing for Responsiveness.

Also see StrictMode.

[Android Documentation]

Requirements

Namespace: Android.OS
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 11

The members of Android.OS.NetworkOnMainThreadException are listed below.

See Also: RuntimeException

Public Constructors

Protected Constructors

A constructor used when creating managed representations of JNI objects; called by the runtime.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.