Reputation: 3329
Blockquote
I am creating my first application with successfully. But now one problem which i facing is when I run my application in android 2.2 then its successfully work. But when I start it with 3.0 or 4.0 its become crash.
I am finding on google but not get perfect idea about this. So that I asking help here.
Please help me to find this.
Thanks in advance.
-Mayank
when run my application in 4.0 version my application stopped and when run 2.2 run successfully... what the problem.. in 4.0 unfortunetely your application has been stopped and application close what the problem help me...
Upvotes: 2
Views: 194
Reputation: 492
This question is of 7 months old. still if some body came to this page by goggling about NetworkOnMainThreadException on android, this is the answer.
If your application have network actions like sending HTTPGet / HTTPPost calls, from Android 3.0 (Honey Comb) sending network calls directly on main thread was not supported as it may stop main thread (UI thread) execution until network call response as the network call may take a long time and UI can't be loaded which is annoying to user experience.
So, sending network calls can be either on separate thread or Android API providing class (AsyncTask).
one more suggestion for android developers is
Start coding on latest version and keep min sdk version to as low as possible (I personally use min SDK- 8 & Target SDK - latest), so that you will get deprecation warnings and your application can run on latest android devices (at least till latest devices at time of development).
Upvotes: 0
Reputation: 5721
You have to give permission on manifest or not.if not then
<uses-sdk android:minSdkVersion="8"
android:targetSdkVersion="15" />
give this permission.
Upvotes: 4
Reputation: 9507
You first read this for creating application with multiple support. You can declare in menifeast file like
<uses-sdk android:minSdkVersion="8"
android:targetSdkVersion="15" />
Upvotes: 3