Discussion Forums  >  Uncategorized

Replies: 36    Views: 840

pandafloski
Aspiring developer
Profile
Posts: 67
Reg: Jun 22, 2011
Austin
670
07/03/11 05:46 PM (14 years ago)

AdMob messing with my app's layout?

I'll insert links for what I'm seeing. Basically though, the ad shows up on the home page, but it's downhill from there... Screens: Home (working ads): http://i1098.photobucket.com/albums/g372/pandafloski/snap20110703_191923.png Screen with messed up nav bar: http://i1098.photobucket.com/albums/g372/pandafloski/snap20110703_191950.png Screen missing the apps entirely?: http://i1098.photobucket.com/albums/g372/pandafloski/snap20110703_191941.png Code: Manifest: http://i1098.photobucket.com/albums/g372/pandafloski/Manifest.png ACT_HOME xml (from res/layout/): http://i1098.photobucket.com/albums/g372/pandafloski/Screenshot2011-07-03at73622PM.png Global title dark ( ) (code is untouched, but it was referenced in the directions I followed): http://i1098.photobucket.com/albums/g372/pandafloski/GlobalTitle.png I'm wondering if maybe I have to make changes like I did on the act home xml also on other screens, but I'm shooting kinda blind.
 
pandafloski
Aspiring developer
Profile
Posts: 67
Reg: Jun 22, 2011
Austin
670
like
07/03/11 05:46 PM (14 years ago)
Sorry, forgot to mention is is on 1.4, android
 
hacerapps
buzztouch Evangelist
Profile
Posts: 542
Reg: Jan 30, 2011
usa
11,170
like
07/03/11 05:56 PM (14 years ago)
you have to play around with the code get your code after <include> if that dont work try after <image view> <com.google.ads.AdView android:id=@+id/adView android:layout_width=wrap_content android:layout_height=wrap_content ads:adUnitid= ads:adSize=Banner ads:loadAdOnCreate=true/>
 
pandafloski
Aspiring developer
Profile
Posts: 67
Reg: Jun 22, 2011
Austin
670
like
07/03/11 05:58 PM (14 years ago)
What do you mean by get your code?
 
hacerapps
buzztouch Evangelist
Profile
Posts: 542
Reg: Jan 30, 2011
usa
11,170
like
07/03/11 06:07 PM (14 years ago)
sorry i am not that good with explanations get your code <com.google.ads.AdView android:id=@+id/adView android:layout_width=wrap_content android:layout_height=wrap_content ads:adUnitid= ads:adSize=Banner ads:loadAdOnCreate=true/> after <include> or after <image view>
 
pandafloski
Aspiring developer
Profile
Posts: 67
Reg: Jun 22, 2011
Austin
670
like
07/03/11 06:09 PM (14 years ago)
oooooh, gotcha. Alright, I'll give it a shot. Also, do you know why the ads aren't showing up elsewhere?
 
hacerapps
buzztouch Evangelist
Profile
Posts: 542
Reg: Jan 30, 2011
usa
11,170
like
07/03/11 06:11 PM (14 years ago)
i am doing a sample so you can copy the code give me a second
 
pandafloski
Aspiring developer
Profile
Posts: 67
Reg: Jun 22, 2011
Austin
670
like
07/03/11 06:11 PM (14 years ago)
thanks!
 
ianJamesPiano
Code is Art
Profile
Posts: 2661
Reg: Feb 13, 2011
Palm Springs, C...
37,010
like
07/03/11 06:14 PM (14 years ago)
love to see this sample copy as well cheers!
 
hacerapps
buzztouch Evangelist
Profile
Posts: 542
Reg: Jan 30, 2011
usa
11,170
like
07/03/11 06:34 PM (14 years ago)
this is for act global list dont forget to add xmlns:ads=http://schemas.android.com/apk/lib/com.google.ads <LinearLayout android:id=@+id/myContent android:layout_height=fill_parent android:layout_width=fill_parent android:layout_marginTop=47dip android:orientation=vertical > <com.google.ads.AdView android:id=@+id/adView <-------------- android:layout_width=wrap_content android:layout_height=wrap_content ads:adUnitId=yourid ads:adSize=BANNER ads:loadAdOnCreate=true/> <ListView android:id=@+id/myList android:layout_width=fill_parent android:layout_height=fill_parent android:background=#000000 android:cacheColorHint=#000000 android:choiceMode=singleChoice android:scrollbars=none />
 
hacerapps
buzztouch Evangelist
Profile
Posts: 542
Reg: Jan 30, 2011
usa
11,170
like
07/03/11 06:43 PM (14 years ago)
screen custom html <?xml version=1.0 encoding=utf-8?> <RelativeLayout android:id=@+id/header xmlns:ads=http://schemas.android.com/apk/lib/com.google.ads xmlns:android=http://schemas.android.com/apk/res/android android:layout_height=fill_parent android:layout_width=fill_parent android:background=#FFFFFF> <include layout=@layout/global_title_dark /> <LinearLayout android:id=@+id/myContent android:layout_height=fill_parent android:layout_width=fill_parent android:layout_marginTop=47dip android:orientation=vertical> <com.google.ads.AdView android:id=@+id/adView <------------------- android:layout_width=wrap_content android:layout_height=wrap_content ads:adUnitId=yourid ads:adSize=BANNER ads:loadAdOnCreate=true/> <WebView xmlns:android=http://schemas.android.com/apk/res/android android:id=@+id/myWebView android:layout_width=fill_parent android:layout_height=fill_parent />
 
hacerapps
buzztouch Evangelist
Profile
Posts: 542
Reg: Jan 30, 2011
usa
11,170
like
07/03/11 06:44 PM (14 years ago)
 
pandafloski
Aspiring developer
Profile
Posts: 67
Reg: Jun 22, 2011
Austin
670
like
07/03/11 06:49 PM (14 years ago)
and remove the adview part from act_home or leave it?
 
pandafloski
Aspiring developer
Profile
Posts: 67
Reg: Jun 22, 2011
Austin
670
like
07/03/11 06:57 PM (14 years ago)
tried adding the code, with and without leaving the code in act_home. Nothing changed :/
 
Annonymous
Profile
07/03/11 10:43 PM (14 years ago)
Also if you decide you want the ads on the bottom as a footer just put this code at bottom after linear layout <com.google.ads.AdView android:layout_height=wrap_content android:id=@+id/adView android:layout_width=wrap_content ads:adUnitId=YOUR_ADMOB_ID_HERE ads:adSize=BANNER ads:loadAdOnCreate=true android:layout_alignParentBottom=true> </com.google.ads.AdView> instead of on the top like this tutorail tells you http://tipstricksandhacks.blogspot.com/2011/06/how-to-add-admob-ads-to-your-buzztouch.html
 
Lyle @SFNeNT
buzztouch Evangelist
Profile
Posts: 168
Reg: Apr 29, 2011
Chicago, IL
2,830
like
07/03/11 10:44 PM (14 years ago)
Also if you decide you want the ads on the bottom as a footer just put this code at bottom after linear layout <com.google.ads.AdView android:layout_height=wrap_content android:id=@+id/adView android:layout_width=wrap_content ads:adUnitId=YOUR_ADMOB_ID_HERE ads:adSize=BANNER ads:loadAdOnCreate=true android:layout_alignParentBottom=true> </com.google.ads.AdView> instead of on the top like this tutorail tells you http://tipstricksandhacks.blogspot.com/2011/06/how-to-add-admob-ads-to-your-buzztouch.html
 
pandafloski
Aspiring developer
Profile
Posts: 67
Reg: Jun 22, 2011
Austin
670
like
07/03/11 11:35 PM (14 years ago)
which layout xml would I embed that in? So far I've tried act_global_list, and nothing happened. Then in act_home it would just make the app FC whenever I tried to open it :/
 
Lyle @SFNeNT
buzztouch Evangelist
Profile
Posts: 168
Reg: Apr 29, 2011
Chicago, IL
2,830
like
07/04/11 12:04 AM (14 years ago)
act_home & act_global_list make shure you put this at the top of each layout you edit...xmlns:ads=http:// schemas.android.com/apk/lib/ com.google.ads and where it says your_admob_id_here put your publisher id in that field ...because buzztouch forums do not allow quotation marks make shure you add them in the proper places to the code above ...you need them before and after the words: wrap_content, BANNER, Your_ADMOB_ID_HERE, @+id/adView, and true
 
pandafloski
Aspiring developer
Profile
Posts: 67
Reg: Jun 22, 2011
Austin
670
like
07/04/11 12:15 AM (14 years ago)
yeah I got the quotations parts. So if I have it embedded in both, that'll stop it from force closing? I want them at the top, my main question is how do I get them to stop meshing my content together and appear on multiple pages (as opposed to just the home page?)
 
pandafloski
Aspiring developer
Profile
Posts: 67
Reg: Jun 22, 2011
Austin
670
like
07/04/11 01:00 AM (14 years ago)
I did exactly like the directions on that how-to, and now my app is force closing. For no apparent reason either, it worked fine the first time I did it this way. I started over because I couldn't figure out how to fix the layout. instead now I'm stuck with this. Someone help me :'(
 
pandafloski
Aspiring developer
Profile
Posts: 67
Reg: Jun 22, 2011
Austin
670
like
07/04/11 01:09 AM (14 years ago)
yeah now my entire app is completely destabilized. I don't know what the eff is going on, and it's getting really frustrating. FC's at random parts, with or without admob code in it
 
gereghas
Aspiring developer
Profile
Posts: 45
Reg: May 14, 2011
Oklahoma
1,250
like
07/04/11 07:32 AM (14 years ago)
I have posted some screenshots on http://tipstricksandhacks.blogspot.com/2011/06/how-to-add-admob-ads-to-your-buzztouch.html I have not been able to get ads to work on the screens with the light colored title bar for some odd reason. As for starting over like you did, I kept a copy of the source I dowloaded from here so when something did mess up severely, I removed the project from the workspace in Eclipse and started with a new project. As I said in my previous post in this forum. It did take me a good 8 hours of hacking the xml code to get what i got accomplished. You have to take into account on the screen size of all the phones available. My phone has a resolution of 854x480. Some phone have a resolution of 800x320. So what looks good on one phone may look like crap on another. Another Tip: before you start any modding of the xml files, MAKE A BACKUP. just make a copy of the xml file somewhere else so when you do mess up all you have to do is replace the modded xml file with the original.
 
Lyle @SFNeNT
buzztouch Evangelist
Profile
Posts: 168
Reg: Apr 29, 2011
Chicago, IL
2,830
like
07/04/11 09:34 AM (14 years ago)
I will create a blog with screen shots on exactly how to do this step by steps. On some screens you may want adds on the top but others its better on the bottom If I where you maybe delete all the added lines of code and start all over again. make shure all your code is right and in the right places. also you can use the graphical layout in eclipse to move the ads around just make shure you re enter any missing important code.
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
07/04/11 12:28 PM (14 years ago)
''I did exactly like the directions on that how-to'' No you haven't, if you've done it as per this screenshot: ACT_HOME xml (from res/layout/): http://i1098.photobucket.com/albums/g372/pandafloski/Screenshot2011-07-03at73622PM.png Admob ads are 50px high, so you need to offset the layouts of the screens you're using by 50px. In your screen shot you've still got the layout_marginTop at 47px, it should be 97px.
 
pandafloski
Aspiring developer
Profile
Posts: 67
Reg: Jun 22, 2011
Austin
670
like
07/04/11 01:37 PM (14 years ago)
I completely missed that raveyd. That may have just made my day if I can get it to not force close =X. I'll try again later
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
07/04/11 03:42 PM (14 years ago)
Good luck with it pandafloski! I've got most of the screens sussed, so drop a post if you have any trouble. The only problem I've got is the same as gereghas - can't get it to work with the light title bar, or rather, sub-menus... very odd. 'Share on Twitter' and the quiz questions page need quite a bit of modifying to fit, especially on a small screen. This is my code for the screen_quizmultiplechoice.xml. It's got admob at the top, removed the quiz image, increased the text area for longer questions, shrunk the buttons, repositioned the timer and score, shrunk the font size and changed the positions of the star, bonus and 'wrong answer' icons that pop up: <?xml version=1.0 encoding=utf-8?> <RelativeLayout android:id=@+id/header xmlns:android=http://schemas.android.com/apk/res/android xmlns:ads=http://schemas.android.com/apk/lib/com.google.ads android:layout_height=fill_parent android:layout_width=fill_parent > <com.google.ads.AdView android:id=@+id/adView android:layout_width=wrap_content android:layout_height=wrap_content ads:adUnitId=1234567890 ads:adSize=BANNER ads:loadAdOnCreate=true/> <include layout=@layout/global_title_dark /> <RelativeLayout android:id=@+id/layoutMain android:layout_width=fill_parent android:layout_height=wrap_content android:layout_marginTop=75dip android:orientation=vertical android:gravity=center_horizontal xmlns:android=http://schemas.android.com/apk/res/android > <ImageView android:id=@+id/imgBackground android:layout_width=320dip android:layout_height=0dip android:scaleType=centerCrop android:src=@drawable/app_default android:layout_alignParentTop=true /> <TextView android:id=@+id/txtQuestion android:layout_width=320dip android:layout_height=125dip android:textSize=20dip android:textColor=#E612BC android:gravity=center_vertical|center_horizontal android:text= android:layout_alignParentTop=true /> <ImageView android:id=@+id/imgRight android:layout_width=85dip android:layout_height=85dip android:scaleType=centerCrop android:src=@drawable/quiz_star android:layout_alignParentTop=true android:layout_alignParentLeft=true android:layout_marginTop=50dip /> <ImageView android:id=@+id/imgWrong android:layout_width=85dip android:layout_height=85dip android:scaleType=centerCrop android:src=@drawable/quiz_wrong android:layout_alignParentTop=true android:layout_alignParentLeft=true android:layout_marginTop=50dip /> <TextView android:id=@+id/txtScore android:layout_width=fill_parent android:layout_height=50dip android:textSize=20dip android:textColor=#FFFFFF android:text= android:layout_below=@+id/imgBackground android:gravity=center_vertical|center_horizontal android:layout_marginTop=100dip /> <ImageView android:id=@+id/imgBonus android:layout_width=85dip android:layout_height=85dip android:scaleType=centerCrop android:src=@drawable/app_blank android:layout_alignParentTop=true android:layout_alignParentLeft=true android:layout_marginTop=50dip /> <RelativeLayout android:id=@+id/layoutButtons android:layout_width=wrap_content android:layout_height=wrap_content android:layout_below=@+id/imgBackground android:orientation=vertical android:gravity=center_horizontal android:layout_marginTop=140dip xmlns:android=http://schemas.android.com/apk/res/android > <Button android:id=@+id/btnQuestion_1 android:layout_width=fill_parent android:layout_height=40dip android:gravity=center_vertical|center_horizontal android:layout_marginLeft=5dip android:layout_marginRight=5dip android:background=@drawable/quiz_btn_gray android:text= android:textSize=16dip android:layout_below=@+id/txtScore /> <Button android:id=@+id/btnQuestion_2 android:layout_width=fill_parent android:layout_height=40dip android:gravity=center_vertical|center_horizontal android:layout_marginLeft=5dip android:layout_marginRight=5dip android:background=@drawable/quiz_btn_gray android:textSize=16dip android:text= android:layout_below=@+id/btnQuestion_1 /> <Button android:id=@+id/btnQuestion_3 android:layout_width=fill_parent android:layout_height=40dip android:gravity=center_vertical|center_horizontal android:layout_marginLeft=5dip android:layout_marginRight=5dip android:background=@drawable/quiz_btn_gray android:textSize=16dip android:text= android:layout_below=@+id/btnQuestion_2 /> <Button android:id=@+id/btnQuestion_4 android:layout_width=fill_parent android:layout_height=40dip android:gravity=center_vertical|center_horizontal android:layout_marginLeft=5dip android:layout_marginRight=5dip android:background=@drawable/quiz_btn_gray android:textSize=16dip android:text= android:layout_below=@+id/btnQuestion_3 /> </RelativeLayout> <TextView android:id=@+id/txtTimer android:layout_width=fill_parent android:layout_height=75dip android:textSize=14dip android:textColor=#FFFFFF android:text= android:layout_below=@+id/layoutButtons android:gravity=center_vertical|center_horizontal /> </RelativeLayout> </RelativeLayout>
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
07/04/11 03:46 PM (14 years ago)
Try a fresh install of the project if your app keeps force closing, it's probably some error in all the modding you've done. Back up everything, every time!
 
Jordan E
Aspiring developer
Profile
Posts: 43
Reg: Jul 10, 2011
Lincoln, NE
430
like
08/09/11 03:24 PM (14 years ago)
Is there anyway someone could create a video this?
 
Lyle @SFNeNT
buzztouch Evangelist
Profile
Posts: 168
Reg: Apr 29, 2011
Chicago, IL
2,830
like
08/09/11 04:00 PM (14 years ago)
 
Jordan E
Aspiring developer
Profile
Posts: 43
Reg: Jul 10, 2011
Lincoln, NE
430
like
08/17/11 04:01 PM (14 years ago)
Here is the tricky part. Since you do not have a main.xml file in your res/layout folder, you need to experiment with the layouts on the individual screens. What do you mean the screens? In the layout folder of the res folder you want us to add what code to each file? And you said that you just put apply this code to every layout with the words screen or act in front of them, where is in front of them ? in front of <?xml version=1.0 encoding=utf-8?> or in front of <resources> This seems to be the only hold up..
 
Lyle @SFNeNT
buzztouch Evangelist
Profile
Posts: 168
Reg: Apr 29, 2011
Chicago, IL
2,830
like
08/17/11 05:19 PM (14 years ago)
Yes sorry for the confusion add the code exactly the way I have it to all the screens you way to display ads on the ones that begin with act or screen are the different screens like custom html or url etc...hope that helps
 
Jordan E
Aspiring developer
Profile
Posts: 43
Reg: Jul 10, 2011
Lincoln, NE
430
like
08/17/11 08:12 PM (14 years ago)
thanks and will try it well everytime I did that and put that code with the admob info untder the <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:layout_height=fill_parent > <com.google.ads.AdView android:id=@+id/adView android:layout_width=wrap_content android:layout_height=wrap_content ads:adUnitId=admobid ads:adSize=BANNER ads:loadAdOnCreate=true/> and then tried to save it would show x red..... also do you know if i can test the ads in emulator bc thus far it has not worked in emulator and wondering if there is something i have to do in order to render the admob ads. any help please would be appreciated.
 
Jordan E
Aspiring developer
Profile
Posts: 43
Reg: Jul 10, 2011
Lincoln, NE
430
like
08/17/11 08:27 PM (14 years ago)
Hey, I got it work now in the emulator and it states, AdView missing required XML attribute adSize. how do i resolve this?
 
Lyle @SFNeNT
buzztouch Evangelist
Profile
Posts: 168
Reg: Apr 29, 2011
Chicago, IL
2,830
like
08/17/11 08:54 PM (14 years ago)
You need to add the update adview in the Android Manifest
 
Jordan E
Aspiring developer
Profile
Posts: 43
Reg: Jul 10, 2011
Lincoln, NE
430
like
08/17/11 09:21 PM (14 years ago)
sry reposted
 
Jordan E
Aspiring developer
Profile
Posts: 43
Reg: Jul 10, 2011
Lincoln, NE
430
like
08/17/11 10:07 PM (14 years ago)
I have checked out the google help forum about this but to no avail. It still states the above mentioned issued when I load the app. I have tired this numerous times and nothing... there was something called bannerexample that was suppose to add in the acitivity section of the manifest but it did not work and showed a red mark when i went to go and save it. Do you know the correct code to adding the update adview in the Android Manifest
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
08/18/11 08:11 AM (14 years ago)
Add the following two lines to the AndroidManifest.xml file, at the bottom, just before the closing application tag. <activity android:name='com.google.ads.AdActivity' android:configChanges='keyboard|keyboardHidden|orientation'/> Make single quotes double quotes, obviously.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.