Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 12    Views: 97

Cyrus_8888
I hate code!
Profile
Posts: 151
Reg: Dec 24, 2011
Sydney
1,610
01/02/13 08:07 PM (13 years ago)

Socialize with Android Integration

Hey Guys, I'm integrating socialize with my android project. I want to get socialize to work with in an Blank Screen only instead of the entire app. Everything seems work like a charm, got actionbar nicely display on the Blank Screen except for one area. I couldn't get background image to display. I have tested the blank screen by itself without socialize integrated which works fine. Does anyone have any clue? Cheers Cyrus
 
Rishav
Code is Art
Profile
Posts: 153
Reg: Jan 26, 2012
Dubai
8,780
like
01/02/13 09:20 PM (13 years ago)
try using action bar with the layout method which is located in the end of actiobar's implementation guide. Its should work then. Thanks, Rishav
 
Cyrus_8888
I hate code!
Profile
Posts: 151
Reg: Dec 24, 2011
Sydney
1,610
like
01/02/13 10:27 PM (13 years ago)
Hi Rishav, Thank you for your response for this. I'm a bit lost. Could you be more specific? Do I need to modify the screen_blank.xml under res/layout/? Thanks Cyrus
 
Rishav
Code is Art
Profile
Posts: 153
Reg: Jan 26, 2012
Dubai
8,780
like
01/03/13 01:33 AM (13 years ago)
yes..try adding the code before relative layout closes..
 
Cyrus_8888
I hate code!
Profile
Posts: 151
Reg: Dec 24, 2011
Sydney
1,610
like
01/03/13 04:37 AM (13 years ago)
Hi Rishav, Thanks for your advice, but still no luck to get it to work. Received errors in logcat. screen_blank.xml: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ScrollView android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_above="@+id/socializeActionBar" android:fillViewport="true" android:isScrollContainer="false"> <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> </LinearLayout> </ScrollView> <!-- The ActionBar MUST appear AFTER your content in your layout --> <com.socialize.ui.actionbar.ActionBarView android:id="@id/socializeActionBar" android:layout_alignParentBottom="true"/> </RelativeLayout> 01-03 22:26:36.450: W/dalvikvm(645): threadid=1: thread exiting with uncaught exception (group=0x409961f8) 01-03 22:26:36.550: E/AndroidRuntime(645): FATAL EXCEPTION: main 01-03 22:26:36.550: E/AndroidRuntime(645): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.steakandroid/com.steakandroid.BT_screen_blank}: java.lang.RuntimeException: Binary XML file line #27: You must supply a layout_width attribute. 01-03 22:26:36.550: E/AndroidRuntime(645): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1955) 01-03 22:26:36.550: E/AndroidRuntime(645): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980) 01-03 22:26:36.550: E/AndroidRuntime(645): at android.app.ActivityThread.access$600(ActivityThread.java:122) 01-03 22:26:36.550: E/AndroidRuntime(645): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146) 01-03 22:26:36.550: E/AndroidRuntime(645): at android.os.Handler.dispatchMessage(Handler.java:99) 01-03 22:26:36.550: E/AndroidRuntime(645): at android.os.Looper.loop(Looper.java:137) 01-03 22:26:36.550: E/AndroidRuntime(645): at android.app.ActivityThread.main(ActivityThread.java:4340) 01-03 22:26:36.550: E/AndroidRuntime(645): at java.lang.reflect.Method.invokeNative(Native Method) 01-03 22:26:36.550: E/AndroidRuntime(645): at java.lang.reflect.Method.invoke(Method.java:511) 01-03 22:26:36.550: E/AndroidRuntime(645): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 01-03 22:26:36.550: E/AndroidRuntime(645): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 01-03 22:26:36.550: E/AndroidRuntime(645): at dalvik.system.NativeStart.main(Native Method) 01-03 22:26:36.550: E/AndroidRuntime(645): Caused by: java.lang.RuntimeException: Binary XML file line #27: You must supply a layout_width attribute. 01-03 22:26:36.550: E/AndroidRuntime(645): at android.content.res.TypedArray.getLayoutDimension(TypedArray.java:491) 01-03 22:26:36.550: E/AndroidRuntime(645): at android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:5297) 01-03 22:26:36.550: E/AndroidRuntime(645): at android.view.ViewGroup$MarginLayoutParams.<init>(ViewGroup.java:5418) 01-03 22:26:36.550: E/AndroidRuntime(645): at android.widget.RelativeLayout$LayoutParams.<init>(RelativeLayout.java:1064) 01-03 22:26:36.550: E/AndroidRuntime(645): at android.widget.RelativeLayout.generateLayoutParams(RelativeLayout.java:933) 01-03 22:26:36.550: E/AndroidRuntime(645): at android.widget.RelativeLayout.generateLayoutParams(RelativeLayout.java:69) 01-03 22:26:36.550: E/AndroidRuntime(645): at android.view.LayoutInflater.rInflate(LayoutInflater.java:741) 01-03 22:26:36.550: E/AndroidRuntime(645): at android.view.LayoutInflater.inflate(LayoutInflater.java:489) 01-03 22:26:36.550: E/AndroidRuntime(645): at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 01-03 22:26:36.550: E/AndroidRuntime(645): at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 01-03 22:26:36.550: E/AndroidRuntime(645): at com.steakandroid.BT_screen_blank.onCreate(BT_screen_blank.java:94) 01-03 22:26:36.550: E/AndroidRuntime(645): at android.app.Activity.performCreate(Activity.java:4465) 01-03 22:26:36.550: E/AndroidRuntime(645): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049) 01-03 22:26:36.550: E/AndroidRuntime(645): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919)
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
01/03/13 05:41 AM (13 years ago)
Looks like you're missing a layout attribute, try using something like: <!-- The ActionBar MUST appear AFTER your content in your layout --> <com.socialize.ui.actionbar.ActionBarView android:id="@id/socializeActionBar" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentBottom="true"/>
 
Cyrus_8888
I hate code!
Profile
Posts: 151
Reg: Dec 24, 2011
Sydney
1,610
like
01/03/13 06:18 AM (13 years ago)
Hi Raveyd, Thanks for your help once again, I think we're getting there. I still couldn't get the bg image to show, also the actionbar appear twice in the emulator. <a href="http://dl.dropbox.com/u/20163884/socialize1.jpg" target="_blank" rel="nofollow">http://dl.dropbox.com/u/20163884/socialize1.jpg</a> Thanks Cyrus
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
01/03/13 06:36 AM (13 years ago)
It might be easier/quicker to just hard code the background image in to the screen. Stick the image into the res > drawable folder and add it here: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/imagename(no .file extension)"> 2 action bars showing... not sure... try wrap_content instead of fill_parent, for one or both of the attributes here: <!-- The ActionBar MUST appear AFTER your content in your layout --> <com.socialize.ui.actionbar.ActionBarView android:id="@id/socializeActionBar" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentBottom="true"/> Also maybe remove the: android:layout_above="@+id/socializeActionBar" from the scrollView
 
Cyrus_8888
I hate code!
Profile
Posts: 151
Reg: Dec 24, 2011
Sydney
1,610
like
01/07/13 06:20 AM (13 years ago)
Hi Raveyd, Awesome man!!! Absolutely brilliant. Thank you guys Cyrus
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
01/07/13 06:30 AM (13 years ago)
Thanks!
 
SrikarSree
Aspiring developer
Profile
Posts: 79
Reg: Jul 22, 2012
Bangalore
7,090
like
02/25/13 01:56 AM (12 years ago)
Hi Raveyd, I am trying to implement socialize into my apps and i have being following you advice in many of the socialize threads. And i though to i will take the xml way to implement this sdk. can you tell me which is the main xml file so that the socialize bar can be visible in every screen.
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
02/25/13 05:21 AM (12 years ago)
Hi @SrikarSree, it depends on your app really - if you have a tabbed layout you can put the code in the tabs xml, or if you have a layout with a list menu put the code in the menu.xml. BT doesn't have a 'main.xml', leaving the choice up to you.
 
SrikarSree
Aspiring developer
Profile
Posts: 79
Reg: Jul 22, 2012
Bangalore
7,090
like
02/26/13 10:24 PM (12 years ago)
Hi Raveyd, Thanks for the input, I had posted a query on socialize forum and i got this reply. ---- The "R" class (as in "R.layout.actionbar") is a class that is automatically generated by ADT and represents the "Resources" in your app. So R.layout is a class representation of all the layout XML files you have in your layout folder. So R.layout.actionbar is referring to a file called actionbar.xml which it is expecting to see in the layout folder of your app. This is just the name of the file in the sample app, you are not expected to have this file. Just replace R.layout.actionbar with the main layout file for the activity you are including the action bar in. Most likely it's something like R.layout.main ----- Could you guide me how to implement this, since you have already mentioned that BT do not have a main.xml.
 

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.