how to layout two ads in a view - exception caused by

Put your problem here if it does not fit any of the other categories.

Re: how to layout two ads in a view - exception caused by

Postby gpolis » Thu Mar 08, 2012 2:41 pm

Hello nuetronprotron ,

i don't have anywhere onResume and onRestart functions..
What must i put in them?

As for the ads ,yes they have wrap_content.

Thanks!
gpolis
Developer
Developer
 
Posts: 38
Joined: Wed Feb 15, 2012 6:28 pm

Top

Re: how to layout two ads in a view - exception caused by

Postby nuetronprotron » Fri Mar 09, 2012 4:54 am

Hi gpolis,
OnResume() and onStart() are callbacks in the activity lifecycle,in your case whenever you try to switch between protrait to landscape mode the activity will be redrawn again newly and invokes normally onResume() callback,so try to do the same as in oncrete() in onResume().
the ad not getting filled in landscape mode is due to you have mentioned it as wrap_content in xml,so it draws only what it needs required.
hope this will help you
nuetronprotron
Developer
Developer
 
Posts: 37
Joined: Tue Jan 10, 2012 10:22 am

Re: how to layout two ads in a view - exception caused by

Postby gpolis » Fri Mar 09, 2012 4:58 pm

Hello nuetronprotron,

When i start the app ,sometimes it gives me a message:

Application Messaging (in process com.android.mms) is not responding.


I press wait and then the app starts.

I tried to do :

Code: Select all
public void onResume(Bundle savedInstanceState) {
       super.onResume();
       onCreate(savedInstanceState);
       
    }
    public void onRestart(Bundle savedInstanceState) {
       super.onRestart();
       onCreate(savedInstanceState);
       
    }


But it's not working.Still the same.I don't know if i had them right.

As for the ads here is a screenshot:


They don't appear in landscape.They don't fit.What should i do? (fill_parent doesn't work either)

Thank you!
Attachments
land.png
land.png (10.56 KiB) Viewed 441 times
gpolis
Developer
Developer
 
Posts: 38
Joined: Wed Feb 15, 2012 6:28 pm

Re: how to layout two ads in a view - exception caused by

Postby Phyll » Sat Mar 10, 2012 5:35 pm

Hi gpolis,

I have been watching the progress of this. It seems to me that at least one of your add classes there might go out to the internet to get its material. That could cause your app to hang if it takes too long. Doesn't it run in its own separate thread?

As for not fitting in the horizontal orientation. Here's a couple of ideas about that. Put the whole layout on a scrollview or do not allow the orientation to change.

Hope this helps.

Phyll
Phyll
Master Developer
Master Developer
 
Posts: 648
Joined: Fri Oct 14, 2011 11:19 am

Re: how to layout two ads in a view - exception caused by

Postby gpolis » Sat Mar 10, 2012 7:54 pm

Hello Phyll,

As for not fitting in the horizontal orientation. Here's a couple of ideas about that. Put the whole layout on a scrollview or do not allow the orientation to change.


I used scrollview,thanks!

I have been watching the progress of this. It seems to me that at least one of your add classes there might go out to the internet to get its material. That could cause your app to hang if it takes too long. Doesn't it run in its own separate thread?


I am sorry ,i can't understand what you are saying.Still have problem with crashes when i change layout..
gpolis
Developer
Developer
 
Posts: 38
Joined: Wed Feb 15, 2012 6:28 pm

Re: how to layout two ads in a view - exception caused by

Postby gpolis » Sun Mar 11, 2012 7:10 pm

Hello ,

Sometimes the app crashes and from logcat i receive :

Code: Select all
03-11 20:02:57.935: D/dalvikvm(286): GC freed 358 objects / 14712 bytes in 670ms
03-11 20:02:57.960: I/dalvikvm-heap(286): Grow heap (frag case) to 4.406MB for 87396-byte allocation
03-11 20:02:58.270: D/dalvikvm(286): GC freed 0 objects / 0 bytes in 308ms
03-11 20:02:58.700: I/MillennialMediaSDK(286): Millennial ad return failed. Zero content length returned.
03-11 20:02:58.720: I/DEBUG(28): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
03-11 20:02:58.720: I/DEBUG(28): Build fingerprint: 'generic/sdk/generi......
03-11 20:02:58.720: I/DEBUG(28): pid: 2...., tid: 29....3  >>> com....Radiation <<<
03-11 20:02:58.720: I/DEBUG(28): signal 11 (SIGSEGV), fault addr 00000000
03-11 20:02:58.720: I/DEBUG(28):  r0 00000007  r1 411b9a50  r2 411b9a50  r3 00000000
03-11 20:02:58.730: I/DEBUG(28):  r4 411b9a50  r5 0018b338  r6 00000000  r7 44e2bcac
03-11 20:02:58.730: I/DEBUG(28):  r8 44e2bda0  r9 4248ce48  10 4248ce34  fp 00000001
03-11 20:02:58.730: I/DEBUG(28):  ip ad083e5c  sp 44e2bc48  lr ad047361  pc ad03fc86  cpsr 00000030
03-11 20:02:58.810: I/DEBUG(28):          #00  pc 0003fc86  /system/lib/libdvm.so
03-11 20:02:58.810: I/DEBUG(28):          #01  pc 0002f480  /system/lib/libdvm.so
03-11 20:02:58.820: I/DEBUG(28):          #02  pc 001f3c3a  /system/lib/libwebcore.so
03-11 20:02:58.820: I/DEBUG(28):          #03  pc 00260b52  /system/lib/libwebcore.so
03-11 20:02:58.820: I/DEBUG(28):          #04  pc 000dac68  /system/lib/libwebcore.so
03-11 20:02:58.820: I/DEBUG(28):          #05  pc 000ecc5c  /system/lib/libwebcore.so
03-11 20:02:58.820: I/DEBUG(28):          #06  pc 000df8f4  /system/lib/libwebcore.so
03-1.......................................
03-11 20:02:58.840: I/DEBUG(28):          #14  pc 00017be4  /system/lib/libdvm.so
03-11 20:02:58.850: I/DEBUG(28):          #15  pc 0001762c  /system/lib/libdvm.so
03-11 20...........................
03-11 20:02:58.860: I/DEBUG(28):          #19  pc 0000f940  /system/lib/libc.so
03-11 20:02:58.860: I/DEBUG(28):          #20  pc 0000f4b4  /system/lib/libc.so
03-11 20:02:58.860: I/DEBUG(28): stack:
03-11 20:02:58.860: I/DEBUG(28):     44e2bc08  44e2bc40 
03-11 20:02:58.860: I/DEBUG(28):     44e2bc0c  0018b338  [heap]
03-11 20:02:58.870: I/DEBUG(28):     44e2bc10  4182712a  /data/dalvik-cache/system@framework@core.jar@classes.dex
03-11 20:02:58.870: I/DEBUG(28):     44e2bc14  4182712b  /data/dalvik-cache/system@framework@core.jar@classes.dex
03-11 20:02:58.870: I/DEBUG(28):     44e2bc18  0018b338  [heap]
03-11 20:02:5..............
03-11 20:02:58.870: I/DEBUG(28):     44e2bc24  4106ffe0  /dev/ashmem/dalvik-LinearAlloc (deleted)
03-11 20:02:58.870: I/DEBUG(28):     44e2bc28  0018b338  [heap]
03-11 20:02................
03-11 20:02:58.880: I/DEBUG(28):     44e2bc34  ad047361  /system/lib/libdvm.so
03-11 20:02:58.880: I/DEBUG(28):     44e2bc38  411b9a50  /dev/ashmem/dalvik-LinearAlloc (deleted)
03-11 20:02:58.880: I/DEBUG(28):     44e2bc3c  0018b338  [heap]
03-11 .......
03-11 20:02:58.890: I/DEBUG(28):     44e2bc58  43821800  /dev/ashmem/mspace/dalvik-heap/2 (deleted)
03-11............
03-11 20:02:58.890: I/DEBUG(28):     44e2bc60  ad03fc71  /system/lib/libdvm.so
03-11 20:02:58.890: I/DEBUG(28):     44e2bc64  0018bd28  [heap]
03-11 20:02:58.890: I/DEBUG(28):     44e2bc68  00000000 
03-11 20:02:58.912: I/DEBUG(28):     44e2bc6c  ad02f483  /system/lib/libdvm.so
03-11 20:02:58.912: I/DEBUG(28): #01 44e2bc70  ad06c610  /system/lib/libdvm.so
03-11 .........
03-11 20:02:58.912: I/DEBUG(28):     44e2bc7c  411b9a50  /dev/ashmem/dalvik-LinearAlloc (deleted)
03-1.........................
03-11 20:02:58.912: I/DEBUG(28):     44e2bc8c  0018bd28  [heap]
03-11 20:02:58.912: I/DEBUG(28):     44e2bc90  00000000 
03-11 20:02:58.912: I/DEBUG(28):     44e2bc94  aa1f3c3d  /system/lib/libwebcore.so
03-11 20:03:00.780: D/dalvikvm(56): GC freed 15225 objects / 689488 bytes in 505ms
03-11 20:03:02.300: D/Zygote(30): Process 286 terminated by signal (11)
03-11 20:03:02.310: I/ActivityManager(56): Process com.....Radiation (pid 286) has died.
03-11 20:03:02.320: I/WindowManager(56): WIN DEATH: Window{4390fd98 com.
03-11 20:03:02.370: I/ActivityManager(56): Start proc com......Radiation for activity com......o.Radiation/.number_cores: pid......
03-11 20:03:02.430: I/jdwp(314): received file descriptor 10 from ADB
03-11 20:03:02.480: D/ddm-heap(314): Got feature list request
03-11 20:03:02.580: W/UsageStats(56): Something wrong here, didn't expect com......Radiation to be resumed
03-11 20:03:05.000: I/MillennialMediaSDK(314): Diagnostic - onRestoreInstanceState
03-11 20:03:05.010: I/Ads(314): adRequestUrlHtml: <html><head><script src.......e-v40.js"></script><script>AFMA_buildAdURL({"...........
03-11 20:03:05.070: I/MillennialMediaSDK(314): Diagnostic - onAttachedToWindow
03-11 20:03:05.120: I/MillennialMediaSDK(314): Diagnostic - No download in progress.
03-11 20:03:05.120: I/MillennialMediaSDK(314): Verbose - Pending download?: false
03-11 20:03:05.120: I/MillennialMediaSDK(314): No incomplete downloads.
03-11 20:03:05.193: I/MillennialMediaSDK(314): Last ad name is null. Call for new ad.
03-11 20:03:06.160: D/dalvikvm(314): GC freed 4643 objects / 295248 bytes in 265ms
03-11 20:03:06.170: D/webviewglue(314): nativeDestroy view: 0x1e6400
03-11 20:03:06.391: I/MillennialMediaSDK(314): Diagnostic - Window Focus Changed. Window in focus?: true
03-11 20:03:06.443: W/InputManagerService(56): Got RemoteException sending setActive(false) notification to pid 286 uid 1.....
03-11 20:03:06.641: I/MillennialMediaSDK(314): Diagnostic - canRequestVideo() Current Time: 1331488986643 last video: 0 Diff: 1331488986 Video interval: 0
03-11 20:03:06.641: I/MillennialMediaSDK(314): Calling for an advertisement:.....
03-11 20:03:07.583: I/ActivityManager(56): Displayed activity com.....Radiation/.number_cores: 5251 ms (total 5251 ms)
03-11 20:03:08.420: D/dalvikvm(314): GC freed 4057 objects / 230808 bytes in 304ms
03-11 20:03:08.480: I/MillennialMediaSDK(314): Millennial ad return failed. Zero content length returned.
03-11 20:03:09.775: D/dalvikvm(97): GC freed 7456 objects / 405728 bytes in 823ms
03-11 20:03:12.390: I/Ads(314): Received ad url: <"url": ".......
03-11 20:03:15.260: I/Ads(314): onReceiveAd()


Somewhere says :
W/UsageStats(56): Something wrong here, didn't expect com......Radiation to be resumed


All of it is because i don't use properly the onResume and onRestart methods?
How should i use them because i haven't see in no book such an example.

Thank you!
gpolis
Developer
Developer
 
Posts: 38
Joined: Wed Feb 15, 2012 6:28 pm

Top

Re: how to layout two ads in a view - exception caused by

Postby gpolis » Mon Mar 12, 2012 3:32 pm

Hello ,

As for the above post ,i found a solution.I use :

Code: Select all
protected void onDestroy() {
        super.onDestroy();

        //workaround for AdMob crash on 1.6
        AdView adView=(AdView)findViewById(R.id.adView1);
        if(adView!=null)
            adView.destroy();
    }


and now it's ok.I removed the onResume and onRestart methods and i don't have a problem when changing layouts.I don't know if its necessary to use these methods.Could you please point me somewhere to learn how exactly to use them in my app?I mean ,what should i have inside these methods?

The logcat gives me :

Code: Select all
An error occurred while loading data in AdWebView:
03-12 16:11:01.910: E/Ads(280): java.lang.NullPointerException
03-12 16:11:01.910: E/Ads(280):    at android.webkit.WebView.loadDataWithBaseURL(WebView.java:1626)
03-12 16:11:01.910: E/Ads(280):    at com.google.ads.h.loadDataWithBaseURL(SourceFile:128)
03-12 16:11:01.910: E/Ads(280):    at com.google.ads.c$c.run(SourceFile:142)


and
W/webcore ( 915): Can't get the viewWidth after the first layout
.
I think the above are from admob but i am receiving ads from admob.
I still not receive ads from millennial media.

--------------EDIT-------------------------
In the emulator i can receive admob ads but in a real device i am not receiving any.

Thank you!
gpolis
Developer
Developer
 
Posts: 38
Joined: Wed Feb 15, 2012 6:28 pm

Top
Previous

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 20 guests