I have been trying to add adMob on my application, but I have naver been able to make it work on my app. Finally I have downloaded a sample adMob app from adMob's web site. However, that doesn't work either. And I get that log below:
11-13 18:24:21.477: D/AndroidRuntime(2225): Shutting down VM
11-13 18:24:21.477: W/dalvikvm(2225): threadid=1: thread exiting with uncaught exception (group=0xb40cb180)
11-13 18:24:21.507: E/AndroidRuntime(2225): FATAL EXCEPTION: main
11-13 18:24:21.507: E/AndroidRuntime(2225): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.example.ads.xml/com.google.example.ads.xml.BannerSample}: android.view.InflateException: Binary XML file line #10: Error inflating class com.google.ads.AdView
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.app.ActivityThread.access$600(ActivityThread.java:123)
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.os.Handler.dispatchMessage(Handler.java:99)
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.os.Looper.loop(Looper.java:137)
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.app.ActivityThread.main(ActivityThread.java:4424)
11-13 18:24:21.507: E/AndroidRuntime(2225): at java.lang.reflect.Method.invokeNative(Native Method)
11-13 18:24:21.507: E/AndroidRuntime(2225): at java.lang.reflect.Method.invoke(Method.java:511)
11-13 18:24:21.507: E/AndroidRuntime(2225): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
11-13 18:24:21.507: E/AndroidRuntime(2225): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
11-13 18:24:21.507: E/AndroidRuntime(2225): at dalvik.system.NativeStart.main(Native Method)
11-13 18:24:21.507: E/AndroidRuntime(2225): Caused by: android.view.InflateException: Binary XML file line #10: Error inflating class com.google.ads.AdView
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:691)
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
11-13 18:24:21.507: E/AndroidRuntime(2225): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.app.Activity.setContentView(Activity.java:1835)
11-13 18:24:21.507: E/AndroidRuntime(2225): at com.google.example.ads.xml.BannerSample.onCreate(BannerSample.java:14)
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.app.Activity.performCreate(Activity.java:4465)
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
11-13 18:24:21.507: E/AndroidRuntime(2225): ... 11 more
11-13 18:24:21.507: E/AndroidRuntime(2225): Caused by: java.lang.ClassNotFoundException: com.google.ads.AdView
11-13 18:24:21.507: E/AndroidRuntime(2225): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
11-13 18:24:21.507: E/AndroidRuntime(2225): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
11-13 18:24:21.507: E/AndroidRuntime(2225): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.view.LayoutInflater.createView(LayoutInflater.java:552)
11-13 18:24:21.507: E/AndroidRuntime(2225): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
11-13 18:24:21.507: E/AndroidRuntime(2225): ... 21 more
11-13 18:24:21.798: I/dalvikvm(2225): threadid=3: reacting to signal 3
11-13 18:24:21.808: I/dalvikvm(2225): Wrote stack traces to '/data/anr/traces.txt'
11-13 18:24:22.148: I/dalvikvm(2225): threadid=3: reacting to signal 3
11-13 18:24:22.158: I/dalvikvm(2225): Wrote stack traces to '/data/anr/traces.txt'
I have gotten this error before, when I got it it was because I had accidentally removed the admobSDK.jar from my application. However, it seems more likely that the below solution will work better for you.
If you are using ADT r17 or higher, then you need to create a libs/ folder in your project, and then copy the adMob SDK into that folder.
Here is another similar post
Error inflating class com.google.ads.AdView
Related
I have a problem but could not be found any solution, I use AsyncHttpClient in https://github.com/AsyncHttpClient/async-http-client, I can run my code in API level 10, but not in API level 17. I am getting this error:
11-13 14:36:47.987 13294-13294/com.modilisim.antalyaticaretborsasi E/com.modilisim.antalyaticaretborsasi.view.fragment.ScrollingBultenlerFragment﹕ error occurred while getting daily bultenler
java.util.concurrent.ExecutionException: java.net.ConnectException: http://...
at com.ning.http.client.providers.netty.NettyResponseFuture.abort(NettyResponseFuture.java:328)
at com.ning.http.client.providers.netty.NettyConnectListener.operationComplete(NettyConnectListener.java:106)
at org.jboss.netty.channel.DefaultChannelFuture.notifyListener(DefaultChannelFuture.java:427)
at org.jboss.netty.channel.DefaultChannelFuture.addListener(DefaultChannelFuture.java:145)
at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.doConnect(NettyAsyncHttpProvider.java:1056)
at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.execute(NettyAsyncHttpProvider.java:880)
at com.ning.http.client.AsyncHttpClient.executeRequest(AsyncHttpClient.java:521)
at com.ning.http.client.AsyncHttpClient$BoundRequestBuilder.execute(AsyncHttpClient.java:238)
at com.modilisim.antalyaticaretborsasi.presenter.BultenPresenter.getDailyBultenler(BultenPresenter.java:126)
at com.modilisim.antalyaticaretborsasi.presenter.BultenPresenter.getDailyBultenler(BultenPresenter.java:102)
at com.modilisim.antalyaticaretborsasi.view.fragment.ScrollingBultenlerFragment.onCreateView(ScrollingBultenlerFragment.java:51)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:900)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1082)
at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1184)
at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:291)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:830)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:736)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at com.modilisim.antalyaticaretborsasi.view.fragment.MainFragment.onCreateView(MainFragment.java:42)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:927)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1467)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:570)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1164)
at android.app.Activity.performStart(Activity.java:5114)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2269)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2356)
at android.app.ActivityThread.access$600(ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5195)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.net.ConnectException: http://...
at com.ning.http.client.providers.netty.NettyConnectListener.operationCom
I am doing a project in a company so I had to hide the urls in the error code above, but urls are working, they are not problem. Any help appreciated, thanks.
I learned that this AsyncHttpClient library is not for Android, so it is not working properly on all versions of Android. There is a library parallel to this library for Android: http://loopj.com/android-async-http/
I found similar topics in stackoverflow but it didn't help for me. I want to show map, but when i run it, it return force close. Here are the codes :
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))
.getMap();
this is my layout :
<fragment
android:id="#+id/map"
android:layout_width="fill_parent"
android:layout_height="300dp"
android:layout_margin="20dp"
class="com.google.android.gms.maps.MapFragment" />
this is my manifest :
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="MY_API_KEY" />
</application>
this my logcat :
11-13 16:03:10.652: E/AndroidRuntime(32202): FATAL EXCEPTION: main
11-13 16:03:10.652: E/AndroidRuntime(32202): java.lang.RuntimeException: Unable to start activity ComponentInfo{id.go.kpp.aplikasipupi/id.go.kpp.aplikasipupi.kartu}: android.view.InflateException: Binary XML file line #739: Error inflating class fragment
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2122)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.app.ActivityThread.access$600(ActivityThread.java:140)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1228)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.os.Handler.dispatchMessage(Handler.java:99)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.os.Looper.loop(Looper.java:137)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.app.ActivityThread.main(ActivityThread.java:4895)
11-13 16:03:10.652: E/AndroidRuntime(32202): at java.lang.reflect.Method.invokeNative(Native Method)
11-13 16:03:10.652: E/AndroidRuntime(32202): at java.lang.reflect.Method.invoke(Method.java:511)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)
11-13 16:03:10.652: E/AndroidRuntime(32202): at dalvik.system.NativeStart.main(Native Method)
11-13 16:03:10.652: E/AndroidRuntime(32202): Caused by: android.view.InflateException: Binary XML file line #739: Error inflating class fragment
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:306)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.app.Activity.setContentView(Activity.java:1912)
11-13 16:03:10.652: E/AndroidRuntime(32202): at id.go.kpp.aplikasipupi.kartu.onCreate(kartu.java:100)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.app.Activity.performCreate(Activity.java:5163)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2061)
11-13 16:03:10.652: E/AndroidRuntime(32202): ... 11 more
11-13 16:03:10.652: E/AndroidRuntime(32202): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4030500 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" />
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.google.android.gms.common.GooglePlayServicesUtil.n(Unknown Source)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.google.android.gms.maps.internal.q.v(Unknown Source)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.google.android.gms.maps.internal.q.u(Unknown Source)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.google.android.gms.maps.MapFragment$b.cE(Unknown Source)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.google.android.gms.maps.MapFragment$b.a(Unknown Source)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.google.android.gms.dynamic.a.a(Unknown Source)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.google.android.gms.dynamic.a.onInflate(Unknown Source)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.app.Activity.onCreateView(Activity.java:4813)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
11-13 16:03:10.652: E/AndroidRuntime(32202): ... 24 more
i don't know why it still error, i hope somebody can help me to solve my problem.
The logcat is clear
You need to add the below to manifest file
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
https://developers.google.com/maps/documentation/android/start#add_the_google_play_services_version_to_your_apps_manifest
Edit your application's AndroidManifest.xml file, and add the following declaration within the <application> element. This embeds the version of Google Play services that the app was compiled with.
I got the same exception as well, but I figured out for Google API v2 to work, you must include these permissions
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
I hope this will help you guys.
P.S I used these permissions for adding a simple map in my app. There are certain other permissions which this link suggests as well.
I'm getting the following error trying to start an activity with a Fragment
08-09 13:50:57.070: ERROR/AndroidRuntime(1446): FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{br.com.zap.imoveis/br.com.zap.imoveis.ui.ResultadoBusca}: android.view.InflateException: Binary XML file line #8: Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class fragment
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
at com.actionbarsherlock.internal.ActionBarSherlockNative.setContentView(ActionBarSherlockNative.java:133)
at com.actionbarsherlock.app.SherlockFragmentActivity.setContentView(SherlockFragmentActivity.java:261)
at br.com.zap.imoveis.ui.ResultadoBusca.onCreate(ResultadoBusca.java:54)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
... 11 more
Caused by: java.lang.ClassCastException: br.com.zap.imoveis.ui.ResultadoBuscaMapa cannot be cast to android.app.Fragment
at android.app.Fragment.instantiate(Fragment.java:577)
at android.app.Fragment.instantiate(Fragment.java:552)
at android.app.Activity.onCreateView(Activity.java:4656)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
... 22 more
Despite of what it says here:
Cannot be cast to android.app.Fragment
I have this error even though my Activity extends from android.support.v4.app.FragmentActivity
Unfortunately, error messages some times are very misleading. I've almost rebuilt my application to find out that during a refactor I have accidentally deleted this line o code
super.onCreate(savedInstanceState);
on the onCreate method of my activity.
Sometimes by starting my activity which only contains a WebView I got this strange log from LogCat:
java.lang.RuntimeException: Unable to start activity ComponentInfo{de.cb.pwapp/de.cb.pwapp.Artikel}:
android.view.InflateException: Binary XML file line #9: Error inflating class android.webkit.WebView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
at android.app.ActivityThread.access$700(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4921)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #9: Error inflating class android.webkit.WebView
at android.view.LayoutInflater.createView(LayoutInflater.java:613)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:313)
at android.app.Activity.setContentView(Activity.java:1924)
at de.cb.pwapp.Artikel.onCreate(Artikel.java:26)
at android.app.Activity.performCreate(Activity.java:5206)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
... 11 more
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:587)
... 24 more
Caused by: java.lang.OutOfMemoryError
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:625)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:478)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:781)
at android.content.res.Resources.loadDrawable(Resources.java:1963)
at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
at android.view.View.<init>(View.java:3449)
at android.view.ViewGroup.<init>(ViewGroup.java:432)
at android.widget.AbsoluteLayout.<init>(AbsoluteLayout.java:52)
at android.webkit.WebView.<init>(WebView.java:505)
at android.webkit.WebView.<init>(WebView.java:482)
at android.webkit.WebView.<init>(WebView.java:468)
at android.webkit.WebView.<init>(WebView.java:457)
Is it correct that my WebView runs out of memory ?
I load the WebView with a long string, representing an article, from my SQLite DB.
Any ideas how to fix this problem ?
High Res Pics as a Background was the Problem
I have several objects defined in XML that are returning null when I try to get a handle on them. I saw several post saying to clean the project but that did not help. When I explore the ListView object all the children are null?? So I am at a bit of a loss as to what I am doing wrong. Here is the code that I think is relevant but if you need to see something else let me know and I'll post it.
TIA
JB
<Button
android:id="#+id/btn_NextLift"
android:layout_width="100dp"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginRight="30dp"
android:layout_marginBottom="40dp"
android:text="#string/str_BtnNxtTxt"
android:onClick="btn_NextLiftClick"
android:longClickable="true" />
In the activity:
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.liftinterface);
...//More code....
...//Still in the OnCreate....
lstvw_LiftData = (ListView)findViewById(R.id.lstvw_LiftData);
...//Image below of this object.....
//Get a handle on our button
Button btn_Nxt = (Button)this.findViewById(R.id.btn_NextLift);
btn_Nxt.setOnLongClickListener(new OnLongClickListener()
{
public boolean onLongClick(View v)
{
SaveAdvance();
return true;
}
});
Here is my logcat errors only:
11-13 22:04:57.798: E/AndroidRuntime(787): FATAL EXCEPTION: main
11-13 22:04:57.798: E/AndroidRuntime(787): java.lang.RuntimeException: Unable to start activity ComponentInfo{org.gpgvm.ironmike/org.gpgvm.ironmike.IcyArmActivity}: java.lang.NullPointerException
11-13 22:04:57.798: E/AndroidRuntime(787): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
11-13 22:04:57.798: E/AndroidRuntime(787): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
11-13 22:04:57.798: E/AndroidRuntime(787): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
11-13 22:04:57.798: E/AndroidRuntime(787): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
11-13 22:04:57.798: E/AndroidRuntime(787): at android.os.Handler.dispatchMessage(Handler.java:99)
11-13 22:04:57.798: E/AndroidRuntime(787): at android.os.Looper.loop(Looper.java:123)
11-13 22:04:57.798: E/AndroidRuntime(787): at android.app.ActivityThread.main(ActivityThread.java:3683)
11-13 22:04:57.798: E/AndroidRuntime(787): at java.lang.reflect.Method.invokeNative(Native Method)
11-13 22:04:57.798: E/AndroidRuntime(787): at java.lang.reflect.Method.invoke(Method.java:507)
11-13 22:04:57.798: E/AndroidRuntime(787): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
11-13 22:04:57.798: E/AndroidRuntime(787): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
11-13 22:04:57.798: E/AndroidRuntime(787): at dalvik.system.NativeStart.main(Native Method)
11-13 22:04:57.798: E/AndroidRuntime(787): Caused by: java.lang.NullPointerException
11-13 22:04:57.798: E/AndroidRuntime(787): at org.gpgvm.ironmike.IcyArmActivity.onCreate(IcyArmActivity.java:83)
11-13 22:04:57.798: E/AndroidRuntime(787): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-13 22:04:57.798: E/AndroidRuntime(787): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
11-13 22:04:57.798: E/AndroidRuntime(787): ... 11 more
When I explore the ListView object all the children are null??
Views are not draw until after onResume() has completed. So the ListView will not have any children in onCreate().
Where is this Button? If it is in the ListView, you need to write a custom adapter to override it's listeners.
Addition
It is in the ListView layout.
You need to extend you current adapter and override getView() to give each row unique listeners like this. Please watch Android's Romain Guy discussion this exact topic in fabulous detail at multiple Google Talk events.