I want created my own camera application. And when I click the button it takes the picture and saves it in the galary. What I want to do is to take the picture without a preview and without clicking any button.
I am searching many but I did not get proper solution one code I founded.But when I run this it is Error.Please give me Exact Solution. You can give me your own project for automatically capture photo and save gallery automatic.
enter link MainActivity.java here
Error:
07-11 09:51:31.885: E/AndroidRuntime(2666): FATAL EXCEPTION: main
07-11 09:51:31.885: E/AndroidRuntime(2666): java.lang.RuntimeException: Unable to resume activity {com.example.capturephotoautometic_one/com.example.capturephotoautometic_one.SimpleCameraIntentFragment}: java.lang.RuntimeException: Fail to connect to camera service
07-11 09:51:31.885: E/AndroidRuntime(2666): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2742)
07-11 09:51:31.885: E/AndroidRuntime(2666): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2771)
07-11 09:51:31.885: E/AndroidRuntime(2666): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2235)
07-11 09:51:31.885: E/AndroidRuntime(2666): at android.app.ActivityThread.access$600(ActivityThread.java:141)
07-11 09:51:31.885: E/AndroidRuntime(2666): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
07-11 09:51:31.885: E/AndroidRuntime(2666): at android.os.Handler.dispatchMessage(Handler.java:99)
07-11 09:51:31.885: E/AndroidRuntime(2666): at android.os.Looper.loop(Looper.java:137)
07-11 09:51:31.885: E/AndroidRuntime(2666): at android.app.ActivityThread.main(ActivityThread.java:5041)
07-11 09:51:31.885: E/AndroidRuntime(2666): at java.lang.reflect.Method.invokeNative(Native Method)
07-11 09:51:31.885: E/AndroidRuntime(2666): at java.lang.reflect.Method.invoke(Method.java:511)
07-11 09:51:31.885: E/AndroidRuntime(2666): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
07-11 09:51:31.885: E/AndroidRuntime(2666): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
07-11 09:51:31.885: E/AndroidRuntime(2666): at dalvik.system.NativeStart.main(Native Method)
07-11 09:51:31.885: E/AndroidRuntime(2666): Caused by: java.lang.RuntimeException: Fail to connect to camera service
07-11 09:51:31.885: E/AndroidRuntime(2666): at android.hardware.Camera.native_setup(Native Method)
07-11 09:51:31.885: E/AndroidRuntime(2666): at android.hardware.Camera.<init>(Camera.java:340)
07-11 09:51:31.885: E/AndroidRuntime(2666): at android.hardware.Camera.open(Camera.java:317)
07-11 09:51:31.885: E/AndroidRuntime(2666): at com.example.capturephotoautometic_one.SimpleCameraIntentFragment.onResume(SimpleCameraIntentFragment.java:46)
07-11 09:51:31.885: E/AndroidRuntime(2666): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1185)
07-11 09:51:31.885: E/AndroidRuntime(2666): at android.app.Activity.performResume(Activity.java:5182)
07-11 09:51:31.885: E/AndroidRuntime(2666): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2732)
07-11 09:51:31.885: E/AndroidRuntime(2666): ... 12 more
Related
I use this code to scale a bitmap in android, But doesn't work and App stops. I attached LOG CAT log
please say what's problem!?
screen=Bitmap.createScaledBitmap(BitmapFactory.decodeResource(getResources(),screenID),gameSurface.width,gameSurface.height,false);
Log Cat::
07-11 19:13:19.878: E/AndroidRuntime(22770): FATAL EXCEPTION: main
07-11 19:13:19.878: E/AndroidRuntime(22770): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.game/com.example.game.GameScreen}: java.lang.IllegalArgumentException: width and height must be > 0
07-11 19:13:19.878: E/AndroidRuntime(22770): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1967)
07-11 19:13:19.878: E/AndroidRuntime(22770): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
07-11 19:13:19.878: E/AndroidRuntime(22770): at android.app.ActivityThread.access$600(ActivityThread.java:127)
07-11 19:13:19.878: E/AndroidRuntime(22770): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
07-11 19:13:19.878: E/AndroidRuntime(22770): at android.os.Handler.dispatchMessage(Handler.java:99)
07-11 19:13:19.878: E/AndroidRuntime(22770): at android.os.Looper.loop(Looper.java:137)
07-11 19:13:19.878: E/AndroidRuntime(22770): at android.app.ActivityThread.main(ActivityThread.java:4441)
07-11 19:13:19.878: E/AndroidRuntime(22770): at java.lang.reflect.Method.invokeNative(Native Method)
07-11 19:13:19.878: E/AndroidRuntime(22770): at java.lang.reflect.Method.invoke(Method.java:511)
07-11 19:13:19.878: E/AndroidRuntime(22770): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
07-11 19:13:19.878: E/AndroidRuntime(22770): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
07-11 19:13:19.878: E/AndroidRuntime(22770): at dalvik.system.NativeStart.main(Native Method)
07-11 19:13:19.878: E/AndroidRuntime(22770): Caused by: java.lang.IllegalArgumentException: width and height must be > 0
07-11 19:13:19.878: E/AndroidRuntime(22770): at android.graphics.Bitmap.createBitmap(Bitmap.java:603)
07-11 19:13:19.878: E/AndroidRuntime(22770): at android.graphics.Bitmap.createBitmap(Bitmap.java:551)
07-11 19:13:19.878: E/AndroidRuntime(22770): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:437)
07-11 19:13:19.878: E/AndroidRuntime(22770): at com.example.game.Map1.<init>(Map1.java:21)
07-11 19:13:19.878: E/AndroidRuntime(22770): at com.example.game.gameSurface.<init>(gameSurface.java:52)
07-11 19:13:19.878: E/AndroidRuntime(22770): at com.example.game.GameScreen.onCreate(GameScreen.java:37)
07-11 19:13:19.878: E/AndroidRuntime(22770): at android.app.Activity.performCreate(Activity.java:4465)
07-11 19:13:19.878: E/AndroidRuntime(22770): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
07-11 19:13:19.878: E/AndroidRuntime(22770): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
07-11 19:13:19.878: E/AndroidRuntime(22770): ... 11 more
try using this in your onCreate
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
screenWidth = size.x;
screenHeight = size.y;
and then use those for your width and height.. my guess is that at the time you are calling the width and height those values are 0 because they are not done drawing or something
In your LOG CAT you can see :
Caused by: java.lang.IllegalArgumentException: width and height must be > 0
So you have probably set gameSurface.width or gameSurface.height to 0.
public static Bitmap createScaledBitmap (Bitmap src, int dstWidth, int dstHeight, boolean filter)
You are getting a IllegalArgumentException because your width is <= 0, or height is <= 0.
I've just downloaded iosched app, to investigate how it handles switching between phone and tablet layouts:
I used EGit and there was an error:
Android requires compiler compliance level 5.0 or 6.0. Found '1.6'
I fixed it easely thanks to this question and Ted Hopp's answer.
Now the project compiled, but right at the start it crashes:
07-11 02:23:37.266: E/AndroidRuntime(1881): FATAL EXCEPTION: main
07-11 02:23:37.266: E/AndroidRuntime(1881):
java.lang.RuntimeException: Unable to get provider
com.google.android.apps.iosched.provider.ScheduleProvider:
java.lang.ClassNotFoundException:
com.google.android.apps.iosched.provider.ScheduleProvider in loader
dalvik.system.PathClassLoader[/data/app/com.google.android.apps.iosched-1.apk]
07-11 02:23:37.266: E/AndroidRuntime(1881): at
android.app.ActivityThread.installProvider(ActivityThread.java:3865)
07-11 02:23:37.266: E/AndroidRuntime(1881): at
android.app.ActivityThread.installContentProviders(ActivityThread.java:3617)
07-11 02:23:37.266: E/AndroidRuntime(1881): at
android.app.ActivityThread.handleBindApplication(ActivityThread.java:3573)
07-11 02:23:37.266: E/AndroidRuntime(1881): at
android.app.ActivityThread.access$2200(ActivityThread.java:123) 07-11
02:23:37.266: E/AndroidRuntime(1881): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1031)
07-11 02:23:37.266: E/AndroidRuntime(1881): at
android.os.Handler.dispatchMessage(Handler.java:99) 07-11
02:23:37.266: E/AndroidRuntime(1881): at
android.os.Looper.loop(Looper.java:126) 07-11 02:23:37.266:
E/AndroidRuntime(1881): at
android.app.ActivityThread.main(ActivityThread.java:3997) 07-11
02:23:37.266: E/AndroidRuntime(1881): at
java.lang.reflect.Method.invokeNative(Native Method) 07-11
02:23:37.266: E/AndroidRuntime(1881): at
java.lang.reflect.Method.invoke(Method.java:491) 07-11 02:23:37.266:
E/AndroidRuntime(1881): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
07-11 02:23:37.266: E/AndroidRuntime(1881): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599) 07-11
02:23:37.266: E/AndroidRuntime(1881): at
dalvik.system.NativeStart.main(Native Method) 07-11 02:23:37.266:
E/AndroidRuntime(1881): Caused by: java.lang.ClassNotFoundException:
com.google.android.apps.iosched.provider.ScheduleProvider in loader
dalvik.system.PathClassLoader[/data/app/com.google.android.apps.iosched-1.apk]
07-11 02:23:37.266: E/AndroidRuntime(1881): at
dalvik.system.PathClassLoader.findClass(PathClassLoader.java:251)
07-11 02:23:37.266: E/AndroidRuntime(1881): at
java.lang.ClassLoader.loadClass(ClassLoader.java:548) 07-11
02:23:37.266: E/AndroidRuntime(1881): at
java.lang.ClassLoader.loadClass(ClassLoader.java:508) 07-11
02:23:37.266: E/AndroidRuntime(1881): at
android.app.ActivityThread.installProvider(ActivityThread.java:3850)
07-11 02:23:37.266: E/AndroidRuntime(1881): ... 12 more
I can see that there this class com.google.android.apps.iosched.provider.ScheduleProvider in the project. Can you help me fix this?
Judging by "I used EGit and there" you most probably used eclipse. I am afraid that the project is created in/for Android Studio and it will be very painful to try to setup it in eclipse - I wasted several hours trying with no luck... ...at the end I gived up and installed the Android Studio. There are more than 20 additional libraries that need to be added to the project in order to be able to run.
I have several free hours so I will give a try to the Android Studio but probably the google guys had to warn us on the project page that the project wont run in eclipse...
(of course there is a BUILDING.txt in the project root)
I have a library project I'm importing in other project. When I try to compile it, console says this (in red):
[2012-07-11 13:12:53 - Library] Could not find Library.apk!
This library contains some custom Views, and when I try to access one of them, it gives me this a Java.lang.RuntimeException caused by a android.view.InflateException which at the same time is caused by a java.lang.ClassNotFoundException on the View class on the Library.
Does anybody know how to solve this?
Here is the LogCat output just in case.
07-11 13:12:53.899: E/AndroidRuntime(16995): FATAL EXCEPTION: main
07-11 13:12:53.899: E/AndroidRuntime(16995): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.cidaut.fragment.manager/com.cidaut.fragment.manager.MainActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class com.cidaut.viewpagerlibrary.TabPageIndicator
07-11 13:12:53.899: E/AndroidRuntime(16995): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2079)
07-11 13:12:53.899: E/AndroidRuntime(16995): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2104)
07-11 13:12:53.899: E/AndroidRuntime(16995): at android.app.ActivityThread.access$600(ActivityThread.java:132)
07-11 13:12:53.899: E/AndroidRuntime(16995): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1157)
07-11 13:12:53.899: E/AndroidRuntime(16995): at android.os.Handler.dispatchMessage(Handler.java:99)
07-11 13:12:53.899: E/AndroidRuntime(16995): at android.os.Looper.loop(Looper.java:137)
07-11 13:12:53.899: E/AndroidRuntime(16995): at android.app.ActivityThread.main(ActivityThread.java:4575)
07-11 13:12:53.899: E/AndroidRuntime(16995): at java.lang.reflect.Method.invokeNative(Native Method)
07-11 13:12:53.899: E/AndroidRuntime(16995): at java.lang.reflect.Method.invoke(Method.java:511)
07-11 13:12:53.899: E/AndroidRuntime(16995): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
07-11 13:12:53.899: E/AndroidRuntime(16995): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
07-11 13:12:53.899: E/AndroidRuntime(16995): at dalvik.system.NativeStart.main(Native Method)
07-11 13:12:53.899: E/AndroidRuntime(16995): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class com.cidaut.viewpagerlibrary.TabPageIndicator
07-11 13:12:53.899: E/AndroidRuntime(16995): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:691)
07-11 13:12:53.899: E/AndroidRuntime(16995): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
07-11 13:12:53.899: E/AndroidRuntime(16995): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
07-11 13:12:53.899: E/AndroidRuntime(16995): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
07-11 13:12:53.899: E/AndroidRuntime(16995): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
07-11 13:12:53.899: E/AndroidRuntime(16995): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
07-11 13:12:53.899: E/AndroidRuntime(16995): at android.app.Activity.setContentView(Activity.java:1835)
07-11 13:12:53.899: E/AndroidRuntime(16995): at com.cidaut.fragment.manager.MainActivity.onCreate(MainActivity.java:17)
07-11 13:12:53.899: E/AndroidRuntime(16995): at android.app.Activity.performCreate(Activity.java:4465)
07-11 13:12:53.899: E/AndroidRuntime(16995): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
07-11 13:12:53.899: E/AndroidRuntime(16995): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2033)
07-11 13:12:53.899: E/AndroidRuntime(16995): ... 11 more
07-11 13:12:53.899: E/AndroidRuntime(16995): Caused by: java.lang.ClassNotFoundException: com.cidaut.viewpagerlibrary.TabPageIndicator
07-11 13:12:53.899: E/AndroidRuntime(16995): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
07-11 13:12:53.899: E/AndroidRuntime(16995): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
07-11 13:12:53.899: E/AndroidRuntime(16995): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
07-11 13:12:53.899: E/AndroidRuntime(16995): at android.view.LayoutInflater.createView(LayoutInflater.java:552)
07-11 13:12:53.899: E/AndroidRuntime(16995): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
07-11 13:12:53.899: E/AndroidRuntime(16995): ... 21 more
I had same problem ,now it's clear by the given action.
Please try Go to your project build path->order and export .Select you library files and press the buttons up,down. It will clear some confusion to get the library files .
I am new to Android development since a few weeks, and I need to write an app that can display the user a live stream multicasted in UDP or RDP. The stream is located at an address such as "rtp://230.0.0.11:1234", and is emitted by WIFI thanks to this module :
http://www.ikusi.es/public/ctrl_public_prod.php?accion=verProducto&id_familia=34&id_gama=186&id_producto=351
I already tried to read it from a player (Daroon player, from PlayStore), and it worked well, so I assume that my foolowing problem is not due to the broadcast.
I saw that it is possible to display video content to the user by different ways :
Using a new Intent with an ACTION_VIEW, and Android selects an app that can view the content;
Using the MediaPlayer class and VideoView.
I have two issues, let us start with the most important :
- For both solution above, there is an issue : I read everywhere that MediaPlayer only support http/s and rtsp protocols, is that right? And for the action view here is what I tried before :
Uri streamURL = Uri.parse("rtp://230.0.0.11:1234");
Intent streamIntent = new Intent(Intent.ACTION_VIEW);
streamIntent.setData(streamURL);
// streamIntent.setDataAndType(streamURL,"video/*");
startActivity(streamIntent);
Here is the LogCat :
07-11 00:25:58.119: D/AndroidRuntime(2659): Shutting down VM
07-11 00:25:58.119: W/dalvikvm(2659): threadid=1: thread exiting with uncaught exception (group=0x40015560)
07-11 00:25:58.129: E/AndroidRuntime(2659): FATAL EXCEPTION: main
07-11 00:25:58.129: E/AndroidRuntime(2659): java.lang.IllegalStateException: Could not execute method of the activity
07-11 00:25:58.129: E/AndroidRuntime(2659): at android.view.View$1.onClick(View.java:2144)
07-11 00:25:58.129: E/AndroidRuntime(2659): at android.view.View.performClick(View.java:2485)
07-11 00:25:58.129: E/AndroidRuntime(2659): at android.view.View$PerformClick.run(View.java:9080)
07-11 00:25:58.129: E/AndroidRuntime(2659): at android.os.Handler.handleCallback(Handler.java:587)
07-11 00:25:58.129: E/AndroidRuntime(2659): at android.os.Handler.dispatchMessage(Handler.java:92)
07-11 00:25:58.129: E/AndroidRuntime(2659): at android.os.Looper.loop(Looper.java:123)
07-11 00:25:58.129: E/AndroidRuntime(2659): at android.app.ActivityThread.main(ActivityThread.java:3683)
07-11 00:25:58.129: E/AndroidRuntime(2659): at java.lang.reflect.Method.invokeNative(Native Method)
07-11 00:25:58.129: E/AndroidRuntime(2659): at java.lang.reflect.Method.invoke(Method.java:507)
07-11 00:25:58.129: E/AndroidRuntime(2659): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
07-11 00:25:58.129: E/AndroidRuntime(2659): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
07-11 00:25:58.129: E/AndroidRuntime(2659): at dalvik.system.NativeStart.main(Native Method)
07-11 00:25:58.129: E/AndroidRuntime(2659): Caused by: java.lang.reflect.InvocationTargetException
07-11 00:25:58.129: E/AndroidRuntime(2659): at java.lang.reflect.Method.invokeNative(Native Method)
07-11 00:25:58.129: E/AndroidRuntime(2659): at java.lang.reflect.Method.invoke(Method.java:507)
07-11 00:25:58.129: E/AndroidRuntime(2659): at android.view.View$1.onClick(View.java:2139)
07-11 00:25:58.129: E/AndroidRuntime(2659): ... 11 more
07-11 00:25:58.129: E/AndroidRuntime(2659): Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=rtp://230.0.0.11:1234 }
07-11 00:25:58.129: E/AndroidRuntime(2659): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1409)
07-11 00:25:58.129: E/AndroidRuntime(2659): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
07-11 00:25:58.129: E/AndroidRuntime(2659): at android.app.Activity.startActivityForResult(Activity.java:2827)
07-11 00:25:58.129: E/AndroidRuntime(2659): at android.app.Activity.startActivity(Activity.java:2933)
07-11 00:25:58.129: E/AndroidRuntime(2659): at fr.infosat.tvreplay.MainActivity.listStream(MainActivity.java:35)
07-11 00:25:58.129: E/AndroidRuntime(2659): ... 14 more
07-11 00:26:00.079: I/Process(2659): Sending signal. PID: 2659 SIG: 9
My understanding is that the error InvocationTargetException, usually due to error on class names, cannot be resolved directly here, since I don't call any class in startActivity. However I think my syntax is not correct, maybe the method is not the right one to use. Of course if I uncomment the setDataAndType line, it displays the same error.
I noticed the error come when I launch my implicit intent.
My second problem is that Daroon Player works well on my set top box, I can see my stream on my TV. But when I try to launch it from Eclipse emulator, it doesn't play, even if I can play it from VLC... Is the emulator powerful enough to read those kind of stream?
I hope that you have some clues on how to solve that! :)
First, you get the exception because there is no app installed on your device which can handle such an rtp:// url.
You may want to check the intent before you start it: queryIntentActivities(..)
Second, I think emulator is pretty slow compared to any available real device, you may not want to use emulator to test A/V streaming.
VLC Android SDK works really perfect in UDP/RTP
https://code.videolan.org/videolan/vlc-android
libvlc
I have a small problem which i couldn't resolve it by myself.
When i launch the app in the emulator, it works fine, but when I try to launch it on device ( SE X10, and Galaxy ACE) the app runs for 2 seconds and crashes.
I think it's adMob problem but ..
Here is the logcat:
07-11 01:45:05.536: W/Ads(1210): java.net.ConnectException: googleads.g.doubleclick.net/127.0.0.1:80 - Connection refused
07-11 01:45:05.536: W/Ads(1210): at org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:207)
07-11 01:45:05.536: W/Ads(1210): at org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:437)
07-11 01:45:05.536: W/Ads(1210): at java.net.Socket.connect(Socket.java:983)
07-11 01:45:05.536: W/Ads(1210): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:75)
07-11 01:45:05.536: W/Ads(1210): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:48)
07-11 01:45:05.536: W/Ads(1210): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection$Address.connect(HttpConnection.java:322)
07-11 01:45:05.536: W/Ads(1210): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionPool.get(HttpConnectionPool.java:89)
07-11 01:45:05.536: W/Ads(1210): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getHttpConnection(HttpURLConnectionImpl.java:294)
07-11 01:45:05.536: W/Ads(1210): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.makeConnection(HttpURLConnectionImpl.java:276)
07-11 01:45:05.536: W/Ads(1210): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:214)
07-11 01:45:05.536: W/Ads(1210): at b.a(Unknown Source)
07-11 01:45:05.536: W/Ads(1210): at b.doInBackground(Unknown Source)
07-11 01:45:05.536: W/Ads(1210): at android.os.AsyncTask$2.call(AsyncTask.java:185)
07-11 01:45:05.536: W/Ads(1210): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
07-11 01:45:05.536: W/Ads(1210): at java.util.concurrent.FutureTask.run(FutureTask.java:138)
07-11 01:45:05.536: W/Ads(1210): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
07-11 01:45:05.536: W/Ads(1210): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
07-11 01:45:05.536: W/Ads(1210): at java.lang.Thread.run(Thread.java:1019)
07-11 01:45:05.536: I/Ads(1210): onFailedToReceiveAd(A network error occurred.)
07-11 01:45:07.826: D/AndroidRuntime(1210): Shutting down VM
07-11 01:45:07.826: W/dalvikvm(1210): threadid=1: thread exiting with uncaught exception (group=0x4001d560)
07-11 01:45:07.856: E/AndroidRuntime(1210): FATAL EXCEPTION: main
07-11 01:45:07.856: E/AndroidRuntime(1210): java.lang.NullPointerException
07-11 01:45:07.856: E/AndroidRuntime(1210): at com.taiic.template.admob.adMain.updateLocation(adMain.java:94)
07-11 01:45:07.856: E/AndroidRuntime(1210): at com.taiic.template.admob.adMain$1.onLocationChanged(adMain.java:45)
07-11 01:45:07.856: E/AndroidRuntime(1210): at android.location.LocationManager$ListenerTransport._handleMessage(LocationManager.java:227)
07-11 01:45:07.856: E/AndroidRuntime(1210): at android.location.LocationManager$ListenerTransport.access$000(LocationManager.java:160)
07-11 01:45:07.856: E/AndroidRuntime(1210): at android.location.LocationManager$ListenerTransport$1.handleMessage(LocationManager.java:176)
07-11 01:45:07.856: E/AndroidRuntime(1210): at android.os.Handler.dispatchMessage(Handler.java:99)
07-11 01:45:07.856: E/AndroidRuntime(1210): at android.os.Looper.loop(Looper.java:123)
07-11 01:45:07.856: E/AndroidRuntime(1210): at android.app.ActivityThread.main(ActivityThread.java:3701)
07-11 01:45:07.856: E/AndroidRuntime(1210): at java.lang.reflect.Method.invokeNative(Native Method)
07-11 01:45:07.856: E/AndroidRuntime(1210): at java.lang.reflect.Method.invoke(Method.java:507)
07-11 01:45:07.856: E/AndroidRuntime(1210): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:862)
07-11 01:45:07.856: E/AndroidRuntime(1210): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
07-11 01:45:07.856: E/AndroidRuntime(1210): at dalvik.system.NativeStart.main(Native Method)
07-11 01:45:07.876: I/Process(1210): Sending signal. PID: 1210 SIG: 9
See that /127.0.0.1:80? From the looks of things you're trying to connect to localhost, which in the device's context is itself.
The Android device probably isn't running a webserver, so it looks like you've misconfigured the ad service somehow.
Make sure you are performing your network connection on a network thread. This is often the cause of weird crashes like the one you are describing. You can read more about it here.
You should always perform potentially long-running/expensive operations on a separate thread!
on emulator you can connect to your computer with localhost but on real device you should use your computer's real ip address 192.168.1.xxx