Nexus 5 and navigator.device.capture.captureAudio - android

There isn't a default audio recorder on the Nexus 5, so calling navigator.device.capture.captureAudio results in:
04-01 14:48:08.562 W/System.err(24130): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.provider.MediaStore.RECORD_SOUND }
04-01 14:48:08.562 W/System.err(24130): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1632)
04-01 14:48:08.562 W/System.err(24130): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
04-01 14:48:08.562 W/System.err(24130): at android.app.Activity.startActivityForResult(Activity.java:3424)
04-01 14:48:08.562 W/System.err(24130): at android.app.Activity.startActivityForResult(Activity.java:3385)
04-01 14:48:08.562 W/System.err(24130): at org.apache.cordova.CordovaActivity.startActivityForResult(CordovaActivity.java:901)
04-01 14:48:08.562 D/CordovaActivity(24130): Paused the application!
04-01 14:48:08.562 D/CordovaWebView(24130): Handle the pause
04-01 14:48:08.562 W/System.err(24130): at org.apache.cordova.mediacapture.Capture.captureAudio(Capture.java:198)
04-01 14:48:08.562 W/System.err(24130): at org.apache.cordova.mediacapture.Capture.execute(Capture.java:99)
04-01 14:48:08.562 W/System.err(24130): at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:65)
04-01 14:48:08.562 W/System.err(24130): at org.apache.cordova.PluginManager.execHelper(PluginManager.java:242)
04-01 14:48:08.562 W/System.err(24130): at org.apache.cordova.PluginManager.exec(PluginManager.java:227)
04-01 14:48:08.562 W/System.err(24130): at org.apache.cordova.ExposedJsApi.exec(ExposedJsApi.java:53)
04-01 14:48:08.562 W/System.err(24130): at com.android.org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
04-01 14:48:08.562 W/System.err(24130): at com.android.org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:27)
04-01 14:48:08.562 W/System.err(24130): at android.os.Handler.dispatchMessage(Handler.java:102)
04-01 14:48:08.562 W/System.err(24130): at android.os.Looper.loop(Looper.java:136)
What are the options for getting an audio recorder working on cordova/phonegap applications for the Nexus 5?

I think you're down to two options:
Capture the error, and prompt user to install a recorder app from app store. This might not be easy though; https://issues.apache.org/jira/browse/CB-5603 says that cordova does the callback with CaptureError.CAPTURE_NO_MEDIA_FILES so it might not be possible to distinguish this error from user returning from recorder without actually recording anything.
Modify cordova framework to provide a fallback Activity that can handle the recording, similar to what is already provided for iOS and WP7/8.

Related

Unfortunately application has stopped using google map api v2

this is my log file
04-01 17:21:32.460: E/dalvikvm(296): Could not find class 'android.app.Notification$Builder', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zza
04-01 17:21:32.470: E/dalvikvm(296): Could not find class 'android.app.AppOpsManager', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zza
04-01 17:21:32.651: E/AndroidRuntime(296): FATAL EXCEPTION: main
04-01 17:21:32.651: E/AndroidRuntime(296): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.tutos.android.gmapv2/com.tutos.android.gmapv2.MyMapActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
04-01 17:21:32.651: E/AndroidRuntime(296): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
04-01 17:21:32.651: E/AndroidRuntime(296): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-01 17:21:32.651: E/AndroidRuntime(296): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-01 17:21:32.651: E/AndroidRuntime(296): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-01 17:21:32.651: E/AndroidRuntime(296): at android.os.Handler.dispatchMessage(Handler.java:99)
04-01 17:21:32.651: E/AndroidRuntime(296): at android.os.Looper.loop(Looper.java:123)
04-01 17:21:32.651: E/AndroidRuntime(296): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-01 17:21:32.651: E/AndroidRuntime(296): at java.lang.reflect.Method.invokeNative(Native Method)
04-01 17:21:32.651: E/AndroidRuntime(296): at java.lang.reflect.Method.invoke(Method.java:521)
04-01 17:21:32.651: E/AndroidRuntime(296): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-01 17:21:32.651: E/AndroidRuntime(296): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-01 17:21:32.651: E/AndroidRuntime(296): at dalvik.system.NativeStart.main(Native Method)
04-01 17:21:32.651: E/AndroidRuntime(296): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
04-01 17:21:32.651: E/AndroidRuntime(296): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:582)
04-01 17:21:32.651: E/AndroidRuntime(296): at android.view.LayoutInflater.inflate(LayoutInflater.java:385)
04-01 17:21:32.651: E/AndroidRuntime(296): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
04-01 17:21:32.651: E/AndroidRuntime(296): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
04-01 17:21:32.651: E/AndroidRuntime(296): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
04-01 17:21:32.651: E/AndroidRuntime(296): at android.app.Activity.setContentView(Activity.java:1647)
04-01 17:21:32.651: E/AndroidRuntime(296): at com.tutos.android.gmapv2.MyMapActivity.onCreate(MyMapActivity.java:19)
04-01 17:21:32.651: E/AndroidRuntime(296): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-01 17:21:32.651: E/AndroidRuntime(296): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
04-01 17:21:32.651: E/AndroidRuntime(296): ... 11 more
04-01 17:21:32.651: E/AndroidRuntime(296): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 7095000 but found 0. You must have the following declaration within the <application> element: <meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
04-01 17:21:32.651: E/AndroidRuntime(296): at com.google.android.gms.common.GooglePlayServicesUtil.zzJ(Unknown Source)
04-01 17:21:32.651: E/AndroidRuntime(296): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
04-01 17:21:32.651: E/AndroidRuntime(296): at com.google.android.gms.maps.internal.zzx.zzad(Unknown Source)
04-01 17:21:32.651: E/AndroidRuntime(296): at com.google.android.gms.maps.internal.zzx.zzac(Unknown Source)
04-01 17:21:32.651: E/AndroidRuntime(296): at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
04-01 17:21:32.651: E/AndroidRuntime(296): at com.google.android.gms.maps.SupportMapFragment$zzb.zzqs(Unknown Source)
04-01 17:21:32.651: E/AndroidRuntime(296): at com.google.android.gms.maps.SupportMapFragment$zzb.zza(Unknown Source)
04-01 17:21:32.651: E/AndroidRuntime(296): at com.google.android.gms.dynamic.zza.zza(Unknown Source)
04-01 17:21:32.651: E/AndroidRuntime(296): at com.google.android.gms.dynamic.zza.onInflate(Unknown Source)
04-01 17:21:32.651: E/AndroidRuntime(296): at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
04-01 17:21:32.651: E/AndroidRuntime(296): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:279)
04-01 17:21:32.651: E/AndroidRuntime(296): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:558)
04-01 17:21:32.651: E/AndroidRuntime(296): ... 19 more
04-01 17:25:30.440: E/dalvikvm(305): Could not find class 'android.app.Notification$Builder', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zza
04-01 17:25:30.460: E/dalvikvm(305): Could not find class 'android.app.AppOpsManager', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zza
04-01 17:25:30.530: E/AndroidRuntime(305): FATAL EXCEPTION: main
04-01 17:25:30.530: E/AndroidRuntime(305): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.tutos.android.gmapv2/com.tutos.android.gmapv2.MyMapActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
04-01 17:25:30.530: E/AndroidRuntime(305): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
04-01 17:25:30.530: E/AndroidRuntime(305): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-01 17:25:30.530: E/AndroidRuntime(305): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-01 17:25:30.530: E/AndroidRuntime(305): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-01 17:25:30.530: E/AndroidRuntime(305): at android.os.Handler.dispatchMessage(Handler.java:99)
04-01 17:25:30.530: E/AndroidRuntime(305): at android.os.Looper.loop(Looper.java:123)
04-01 17:25:30.530: E/AndroidRuntime(305): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-01 17:25:30.530: E/AndroidRuntime(305): at java.lang.reflect.Method.invokeNative(Native Method)
04-01 17:25:30.530: E/AndroidRuntime(305): at java.lang.reflect.Method.invoke(Method.java:521)
04-01 17:25:30.530: E/AndroidRuntime(305): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-01 17:25:30.530: E/AndroidRuntime(305): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-01 17:25:30.530: E/AndroidRuntime(305): at dalvik.system.NativeStart.main(Native Method)
04-01 17:25:30.530: E/AndroidRuntime(305): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
04-01 17:25:30.530: E/AndroidRuntime(305): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:582)
04-01 17:25:30.530: E/AndroidRuntime(305): at android.view.LayoutInflater.inflate(LayoutInflater.java:385)
04-01 17:25:30.530: E/AndroidRuntime(305): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
04-01 17:25:30.530: E/AndroidRuntime(305): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
04-01 17:25:30.530: E/AndroidRuntime(305): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
04-01 17:25:30.530: E/AndroidRuntime(305): at android.app.Activity.setContentView(Activity.java:1647)
04-01 17:25:30.530: E/AndroidRuntime(305): at com.tutos.android.gmapv2.MyMapActivity.onCreate(MyMapActivity.java:19)
04-01 17:25:30.530: E/AndroidRuntime(305): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-01 17:25:30.530: E/AndroidRuntime(305): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
04-01 17:25:30.530: E/AndroidRuntime(305): ... 11 more
04-01 17:25:30.530: E/AndroidRuntime(305): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 7095000 but found 0. You must have the following declaration within the <application> element: <meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
04-01 17:25:30.530: E/AndroidRuntime(305): at com.google.android.gms.common.GooglePlayServicesUtil.zzJ(Unknown Source)
04-01 17:25:30.530: E/AndroidRuntime(305): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
04-01 17:25:30.530: E/AndroidRuntime(305): at com.google.android.gms.maps.internal.zzx.zzad(Unknown Source)
04-01 17:25:30.530: E/AndroidRuntime(305): at com.google.android.gms.maps.internal.zzx.zzac(Unknown Source)
04-01 17:25:30.530: E/AndroidRuntime(305): at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
04-01 17:25:30.530: E/AndroidRuntime(305): at com.google.android.gms.maps.SupportMapFragment$zzb.zzqs(Unknown Source)
04-01 17:25:30.530: E/AndroidRuntime(305): at com.google.android.gms.maps.SupportMapFragment$zzb.zza(Unknown Source)
04-01 17:25:30.530: E/AndroidRuntime(305): at com.google.android.gms.dynamic.zza.zza(Unknown Source)
04-01 17:25:30.530: E/AndroidRuntime(305): at com.google.android.gms.dynamic.zza.onInflate(Unknown Source)
04-01 17:25:30.530: E/AndroidRuntime(305): at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
04-01 17:25:30.530: E/AndroidRuntime(305): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:279)
04-01 17:25:30.530: E/AndroidRuntime(305): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:558)
04-01 17:25:30.530: E/AndroidRuntime(305): ... 19 more
Your manifest.xml file is missing the below line, just add it and it should fix your problem.
Edit your application's AndroidManifest.xml file, and add the following declaration within the element. This embeds the version of Google Play services that the app was compiled with.
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Android developers guide for more details https://developers.google.com/maps/documentation/android/start

android google map activity open more than two times , than out of memory error issue came

here, I am using google map v2 api for draw multiple path(using polyline) on google map.
Note : when click button to start new google map activity class and draw path on first time successfully.then, click back button and again start the same map activity class and draw multiple path.
then, same thing, click back button and start the same map activity means , suddenly out of memory error will be coming.
Error output..
04-01 03:12:46.165: E/AndroidRuntime(7803): FATAL EXCEPTION: main
04-01 03:12:46.165: E/AndroidRuntime(7803): java.lang.OutOfMemoryError
04-01 03:12:46.165: E/AndroidRuntime(7803): at java.util.ArrayList.add(ArrayList.java:118)
04-01 03:12:46.165: E/AndroidRuntime(7803): at com.google.android.gms.maps.model.PolylineOptions.add(Unknown Source)
04-01 03:12:46.165: E/AndroidRuntime(7803): at com.TruckLogics.UserController.UserOrderListMapView.drawdirection(UserOrderListMapView.java:483)
04-01 03:12:46.165: E/AndroidRuntime(7803): at com.TruckLogics.UserController.UserOrderListMapView.access$1(UserOrderListMapView.java:453)
04-01 03:12:46.165: E/AndroidRuntime(7803): at com.TruckLogics.UserController.UserOrderListMapView$GetRouteTask$1.run(UserOrderListMapView.java:228)
04-01 03:12:46.165: E/AndroidRuntime(7803): at android.app.Activity.runOnUiThread(Activity.java:4673)
04-01 03:12:46.165: E/AndroidRuntime(7803): at com.TruckLogics.UserController.UserOrderListMapView$GetRouteTask.onPostExecute(UserOrderListMapView.java:225)
04-01 03:12:46.165: E/AndroidRuntime(7803): at com.TruckLogics.UserController.UserOrderListMapView$GetRouteTask.onPostExecute(UserOrderListMapView.java:1)
04-01 03:12:46.165: E/AndroidRuntime(7803): at android.os.AsyncTask.finish(AsyncTask.java:631)
04-01 03:12:46.165: E/AndroidRuntime(7803): at android.os.AsyncTask.access$600(AsyncTask.java:177)
04-01 03:12:46.165: E/AndroidRuntime(7803): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
04-01 03:12:46.165: E/AndroidRuntime(7803): at android.os.Handler.dispatchMessage(Handler.java:99)
04-01 03:12:46.165: E/AndroidRuntime(7803): at android.os.Looper.loop(Looper.java:137)
04-01 03:12:46.165: E/AndroidRuntime(7803): at android.app.ActivityThread.main(ActivityThread.java:5103)
04-01 03:12:46.165: E/AndroidRuntime(7803): at java.lang.reflect.Method.invokeNative(Native Method)
04-01 03:12:46.165: E/AndroidRuntime(7803): at java.lang.reflect.Method.invoke(Method.java:525)
04-01 03:12:46.165: E/AndroidRuntime(7803): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
04-01 03:12:46.165: E/AndroidRuntime(7803): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
04-01 03:12:46.165: E/AndroidRuntime(7803): at dalvik.system.NativeStart.main(Native Method)
Expected output :
when start new activity, how to clear previous activity used memory..
how to clear cache memory while jumping another activity..
Try android:largeHeap="true" in Manifest's application tag

Resolution specific subfolders of res directory crash the app

I have created a Phone & Tablet app for android and have the generic layout folder populated with the layouts, I then created two additional folders in the res directory with the suffix -sw600dp & -sw720dp and it is not working and the app is crashing every time no matter what I try. Can someone please give me some other options.
Log Cat Error:
04-01 02:34:23.567: E/AndroidRuntime(898): FATAL EXCEPTION: main
04-01 02:34:23.567: E/AndroidRuntime(898): java.lang.NullPointerException
04-01 02:34:23.567: E/AndroidRuntime(898): at za.co.astroweb.watsonline.wats_online_fragment$getBlogPosts.onPostExecute(wats_online_fragment.java:173)
04-01 02:34:23.567: E/AndroidRuntime(898): at za.co.astroweb.watsonline.wats_online_fragment$getBlogPosts.onPostExecute(wats_online_fragment.java:1)
04-01 02:34:23.567: E/AndroidRuntime(898): at android.os.AsyncTask.finish(AsyncTask.java:631)
04-01 02:34:23.567: E/AndroidRuntime(898): at android.os.AsyncTask.access$600(AsyncTask.java:177)
04-01 02:34:23.567: E/AndroidRuntime(898): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
04-01 02:34:23.567: E/AndroidRuntime(898): at android.os.Handler.dispatchMessage(Handler.java:99)
04-01 02:34:23.567: E/AndroidRuntime(898): at android.os.Looper.loop(Looper.java:137)
04-01 02:34:23.567: E/AndroidRuntime(898): at android.app.ActivityThread.main(ActivityThread.java:5103)
04-01 02:34:23.567: E/AndroidRuntime(898): at java.lang.reflect.Method.invokeNative(Native Method)
04-01 02:34:23.567: E/AndroidRuntime(898): at java.lang.reflect.Method.invoke(Method.java:525)
04-01 02:34:23.567: E/AndroidRuntime(898): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
04-01 02:34:23.567: E/AndroidRuntime(898): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
04-01 02:34:23.567: E/AndroidRuntime(898): at dalvik.system.NativeStart.main(Native Method)

SherlockActionBar is not working on Android 2.3.6 (Force Close)

However, on Android 4.0.3 it is working fine.
Isn't Sherlock supposed to give ActionBar for 2.xx versions too ?
I added : android:theme="#style/Sherlock.__Theme.Light" to the manifest file.
I am not running anything on the application only this:
public class MainActivity extends SherlockActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
I tried also extends SherlockFragmentActivity
It also force closed on 2.3.6. However, on 4.0.3 it worked.
Any expert can tell me where the problem is?
EDIT:
04-01 23:24:29.210: E/AndroidRuntime(18249): FATAL EXCEPTION: main
04-01 23:24:29.210: E/AndroidRuntime(18249): java.lang.RuntimeException: Unable to start activity ComponentInfo{edu.lau.autointernetconnector/edu.lau.autointernetconnector.MainActivity}: java.lang.IllegalStateException: You must use Theme.Sherlock, Theme.Sherlock.Light, Theme.Sherlock.Light.DarkActionBar, or a derivative.
04-01 23:24:29.210: E/AndroidRuntime(18249): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
04-01 23:24:29.210: E/AndroidRuntime(18249): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
04-01 23:24:29.210: E/AndroidRuntime(18249): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
04-01 23:24:29.210: E/AndroidRuntime(18249): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
04-01 23:24:29.210: E/AndroidRuntime(18249): at android.os.Handler.dispatchMessage(Handler.java:99)
04-01 23:24:29.210: E/AndroidRuntime(18249): at android.os.Looper.loop(Looper.java:130)
04-01 23:24:29.210: E/AndroidRuntime(18249): at android.app.ActivityThread.main(ActivityThread.java:3691)
04-01 23:24:29.210: E/AndroidRuntime(18249): at java.lang.reflect.Method.invokeNative(Native Method)
04-01 23:24:29.210: E/AndroidRuntime(18249): at java.lang.reflect.Method.invoke(Method.java:507)
04-01 23:24:29.210: E/AndroidRuntime(18249): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907)
04-01 23:24:29.210: E/AndroidRuntime(18249): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
04-01 23:24:29.210: E/AndroidRuntime(18249): at dalvik.system.NativeStart.main(Native Method)
04-01 23:24:29.210: E/AndroidRuntime(18249): Caused by: java.lang.IllegalStateException: You must use Theme.Sherlock, Theme.Sherlock.Light, Theme.Sherlock.Light.DarkActionBar, or a derivative.
04-01 23:24:29.210: E/AndroidRuntime(18249): at com.actionbarsherlock.internal.ActionBarSherlockCompat.generateLayout(ActionBarSherlockCompat.java:1003)
04-01 23:24:29.210: E/AndroidRuntime(18249): at com.actionbarsherlock.internal.ActionBarSherlockCompat.installDecor(ActionBarSherlockCompat.java:915)
04-01 23:24:29.210: E/AndroidRuntime(18249): at com.actionbarsherlock.internal.ActionBarSherlockCompat.setContentView(ActionBarSherlockCompat.java:849)
04-01 23:24:29.210: E/AndroidRuntime(18249): at com.actionbarsherlock.app.SherlockActivity.setContentView(SherlockActivity.java:229)
04-01 23:24:29.210: E/AndroidRuntime(18249): at edu.lau.autointernetconnector.MainActivity.onCreate(MainActivity.java:12)
04-01 23:24:29.210: E/AndroidRuntime(18249): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-01 23:24:29.210: E/AndroidRuntime(18249): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
04-01 23:24:29.210: E/AndroidRuntime(18249): ... 11 more
Although you answered your question yourself (based of the comment ChristopheCVB gave) I'd still like to add something.
However, on Android 4.0.3 it is working fine. Isn't Sherlock supposed
to give ActionBar for 2.xx versions too ?
ActionBarSherlock only provides the ActionBar for versions below Honeycomb. The ActionBar you see on HC+ are all native implementations.
#style/Sherlock.__Theme.Light will not fail on HC+ because they already have all necessary styles set.
I solved my issue... I can't believe i couldn't solve it until I posted it here.
I put this in manifest : android:theme="#style/Theme.Sherlock.Light" instead of android:theme="#style/Sherlock.__Theme.Light" and it worked :)

How to add AdView from AdMob to a ListView

I'm confused at how to make adview from admob work with a listview. I'm new to ads and have just finished the basic tutorial but now trying to put in in my own app. I have some things commented out that I tried to do to begin with.
// Create the adView
AdView adView = new AdView(this, AdSize.BANNER, myID);
// Lookup your LinearLayout assuming it’s been given
// the attribute android:id="#+id/mainLayout"
// LinearLayout layout = (LinearLayout)findViewById(R.id.linearLayout);
// Add the adView to it
lv.addView(adView);
// Initiate a generic request to load it with an ad
adView.loadAd(new AdRequest());
<TextView android:id="#+id/itemName" android:layout_width="wrap_content"
android:layout_height="50dip" android:text="Test view"
android:textSize = "25sp"
android:singleLine = "true"/>
04-01 19:28:58.163: ERROR/AndroidRuntime(421): FATAL EXCEPTION: main
04-01 19:28:58.163: ERROR/AndroidRuntime(421):
java.lang.RuntimeException: Unable to start activity
ComponentInfo{org.demo.textaway2/org.demo.textaway2.TextAway2}:
java.lang.UnsupportedOperationException: addView(View) is not
supported in AdapterView 04-01 19:28:58.163:
ERROR/AndroidRuntime(421): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
04-01 19:28:58.163: ERROR/AndroidRuntime(421): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-01 19:28:58.163: ERROR/AndroidRuntime(421): at
android.app.ActivityThread.access$2300(ActivityThread.java:125) 04-01
19:28:58.163: ERROR/AndroidRuntime(421): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-01 19:28:58.163: ERROR/AndroidRuntime(421): at
android.os.Handler.dispatchMessage(Handler.java:99) 04-01
19:28:58.163: ERROR/AndroidRuntime(421): at
android.os.Looper.loop(Looper.java:123) 04-01 19:28:58.163:
ERROR/AndroidRuntime(421): at
android.app.ActivityThread.main(ActivityThread.java:4627) 04-01
19:28:58.163: ERROR/AndroidRuntime(421): at
java.lang.reflect.Method.invokeNative(Native Method) 04-01
19:28:58.163: ERROR/AndroidRuntime(421): at
java.lang.reflect.Method.invoke(Method.java:521) 04-01 19:28:58.163:
ERROR/AndroidRuntime(421): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-01 19:28:58.163: ERROR/AndroidRuntime(421): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 04-01
19:28:58.163: ERROR/AndroidRuntime(421): at
dalvik.system.NativeStart.main(Native Method) 04-01 19:28:58.163:
ERROR/AndroidRuntime(421): Caused by:
java.lang.UnsupportedOperationException: addView(View) is not
supported in AdapterView 04-01 19:28:58.163:
ERROR/AndroidRuntime(421): at
android.widget.AdapterView.addView(AdapterView.java:435) 04-01
19:28:58.163: ERROR/AndroidRuntime(421): at
org.demo.textaway2.TextAway2.onCreate(TextAway2.java:164) 04-01
19:28:58.163: ERROR/AndroidRuntime(421): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-01 19:28:58.163: ERROR/AndroidRuntime(421): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
04-01 19:28:58.163: ERROR/AndroidRuntime(421): ... 11 more
The stack trace includes this:
addView(View) is not supported in AdapterView
Which answers your question - you can't use AdMob in an AdapterView or its subclasses, which you're trying to do. You'll either need to write your own View class to render the list objects, use a different ad service (adwhirl etc - perhaps another doesn't have this limitation) or move the ad(s) outside the list, into a footer/header.

Categories

Resources