Comments (26)
Moreover it often gets the application to crash :\
from facebook-android-sdk.
Ya, this is a known issue, but it appears to be a non-trivial change to correct. If you have a simple fix, please send me a code diff and I will take a look; otherwise, sorry, I don't have an ETA for a fix. In the meantime, you can simply prevent your app from rotating by adding
android:screenOrientation="portrait"
as a property of your activity in the application manifest.
from facebook-android-sdk.
soneff, try to use setOwnerActivity() on the dialog itself. This should wire it up to the context and maintain the dialog ;)
from facebook-android-sdk.
http://developer.android.com/guide/topics/ui/dialogs.html
from facebook-android-sdk.
Hello,
Add this code in the manifest file for the Example activity. This will retrain the dialog when the orientation is changed.
android:configChanges="keyboardHidden|orientation"
from facebook-android-sdk.
This patch will at least act as a bandaid over the crash. I too would like to see a solution to the overall problem that doesn't involve manually handling configchanges
diff -r 44b3f51dfe41 facebook/src/com/facebook/android/FbDialog.java
--- a/facebook/src/com/facebook/android/FbDialog.java Wed Jul 14 15:52:05 2010 -0400
+++ b/facebook/src/com/facebook/android/FbDialog.java Wed Jul 14 16:18:27 2010 -0400
@@ -162,7 +162,11 @@
if (title != null && title.length() > 0) {
mTitle.setText(title);
}
- mSpinner.dismiss();
+ try {
+ mSpinner.dismiss();
+ } catch( IllegalArgumentException ignored ) {
+ // thrown if the underlying activity was dismissed, eg. during device orientation change
+ }
}
}
from facebook-android-sdk.
This solution:
android:configChanges="keyboardHidden|orientation"
Doesn't quite work well. In my case I attach a picture to the post and that picture makes the dialog taller. When rotating the screen when this option is activated, the buttons "publish" and "skip" disappear from the screen and the user cannot press them anymore, the only solution is to rotate the screen back. The dialog does not scroll.
This problem does not occur when the configChanges setting is not set (but then it crashes when the user rotates the screen too much...). And the layout is OK before rotation (OK when the phone is held vertically, OK when held horizontally, the problem comes after rotation).
The problem with not supporting rotation is that I must turn it off for my whole activity, it seems I can't do it for just this dialog. And the rest of that activity profits from screen rotation.
Also the try/catch workaround from emmby is not quite enough. The other dismiss at around line 127 still triggers the crash even after that try/catch is added. So I guess try/catch must be added in still other locations.
from facebook-android-sdk.
What's the status on this? The library consistently still crashes whenever a user changes their orientation.
from facebook-android-sdk.
I've fixed dialog rotation in my fork of facebook-android-sdk: http://github.com/Pretz/facebook-android-sdk
To fix it I had to change how you show the dialog; you'll need to use Activity.showDialog() and create the dialog in a separate step. I updated the simple example to do this.
from facebook-android-sdk.
Pretz,
I tried out your fix and the change to how you display the dialog and it worked correctly. Thanks for the fix!
Are there are lot of changes in your fork that might affect calls to the Facebook graph api, or are your changes simply fixing display issues? I'm trying to get an idea of how "safe" it is to take your branch or how much testing i should do with it.
Also, we should get that fix back in the official master!
from facebook-android-sdk.
jaredbro, I tried to keep my changes as minimal as possible. While it did require significantly changing how the dialog is displayed, I didn't touch any of the logic concerning the Graph API.
I've already sent a pull request to facebook; hopefully my changes can be integrated soon.
Cheers!
from facebook-android-sdk.
Just having a play with Pretz branch because of the dialog issues it says its fixed.
The main difference that I can see is that rather than trying to keep the dialog open and reload it when orientation it just dismisses it, making the user have to click the button again.
from facebook-android-sdk.
The Pretz branch fixes the problem if you wait for the content to finish loading but if you change orientation before the content has finished loading it leaks memory and crashes still.
from facebook-android-sdk.
@pteale I haven't been able to reproduce a crash while the webview is loading. Can you describe exactly what you did for that to happen? How did you show the dialog in the first place?
from facebook-android-sdk.
@Pretz I was showing the dialog incorrectly, followed your example code and it works well. Deleting my previous post about the download part as its misleading
from facebook-android-sdk.
Really, the FbDialog code should not be written as a Dialog, but rather an Activity with Theme.Dialog applied to it. Then FB can achieve the partial screen coverage appearance they desire. but allowing the view to manage it's own state during rotation. Regardless, views that interact with a keyboard but do not support rotation might as well not exist because that is the ultimate UX fail on Android. Please fix this ASAP, or pull Pretz's fork.
from facebook-android-sdk.
@wirelessdesigns I agree. Unfortunately, I can no longer recommend my fork as it doesn't support instant connect through the Facebook app, and I don't plan on updating it to the latest facebook SDK features.
Until Facebook provides a better solution, I recommend having any activity that can launch fbDialog declare android:configChanges="keyboardHidden|orientation" in the manifest, which will keep the dialog on screen when the orientation changes. Unfortunately, if your activity depends on different resources for landscape/portrait, this could require a certain amount of work
from facebook-android-sdk.
Facebook: please develop a work around for this. Many Android devices have slide out keyboards and/or users that like to type in landscape mode. Forcing an app to stay in portrait just to avoid force close issues makes for a poor user experience.
from facebook-android-sdk.
This took me a while but I solved this in a similar fashion, although it required more than just setting the configChanges="orientation". Just adding that would keep the dialog on screen but it would keep it in its current orientation. In other words if you were in landscape with a landscape dialog and switched to portrait you would end up in portrait with a landscape dialog. Almost as bad as the crashing.
So, I did the following:
- added a redraw() method to FbDialog that would redraw the dialog on request
- in whatever activity I wanted to show the dialog I added the configChange="orientation" and in the onConfigurationChanged call I called the redraw() method.
This seems to work and have had no more reports of crashing in my app. I did not have to change anything else about how I showed the dialog or was using the API.
In addition to that I added a redraw() method to redraw the dialog
from facebook-android-sdk.
Thx sroorda. That could work. Can you post your FbDialog.redraw method?
from facebook-android-sdk.
I have one suggestion. It would be better if the dialog had the same layout for both orientations. Then the solution with android:configChanges="keyboardHidden|orientation" will work well. I think, it is the best solution for now, since it doesn't crash on orientation changes, the dialog looks nice for any display and any orientation, and it saves its state on orientation changes(if user has already entered his login or password)
technical details: mWebView should use WRAP_CONTENT layout. mContent should use WRAP_CONTENT or FILL_PARENT layout. it looks better, if subviews added to dialog when webView has already loaded.
Pretz, your solution more correctly, waiting for it! but in this case it also be better to have one layout for different orientations(in case of an activity doesn't recreates on rotation),as I suggest upper
from facebook-android-sdk.
Has there been any progress made on this issue?
from facebook-android-sdk.
reading this thread makes me feel embarraced for facebook.
from facebook-android-sdk.
Any news on this issue? It's unacceptable
from facebook-android-sdk.
I had a same issue when I use android:configChanges="keyboardHidden|orientation
To solve this, I modified FbDialog.java.
--mContent = new LinearLayout(getContext());
++mContent = new ConfigChangeLinearLayout(getContext(), this);
ConfigChangeLinearLayout is a custom LinearLayout which resizes when configuration changed.
private static class ConfigChangeLinearLayout extends LinearLayout {
private Dialog mDialog;
public ConfigChangeLinearLayout(Context context, Dialog dialog) {
super(context);
mDialog = dialog;
}
@Override
protected void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
Display display = mDialog.getWindow().getWindowManager().getDefaultDisplay();
final float scale =
getContext().getResources().getDisplayMetrics().density;
float[] dimensions =
(newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE)
? DIMENSIONS_DIFF_LANDSCAPE : DIMENSIONS_DIFF_PORTRAIT;
setLayoutParams(new FrameLayout.LayoutParams(
display.getWidth() - ((int) (dimensions[0] * scale + 0.5f)),
display.getHeight() - ((int) (dimensions[1] * scale + 0.5f))));
}
}
from facebook-android-sdk.
This issue was raised against an previous version of the Facebook SDK for Android.
In 2012, the SDK had a significant rewrite and relaunch, and we are closing issues and pull requests that predate that v3.0 release.
If you are still experiencing this issue, please raise a new issue with repro steps in the supported SDK (currently v3.6). For more information, please see our Android developer center at https://developers.facebook.com/docs/android.
Many thanks for using the Facebook Platform, and your support of this project.
from facebook-android-sdk.
Related Issues (20)
- Unexpected "Invalid app id" error HOT 1
- Is this repository live? No answers from Facebook employees to many critical issues
- ANR:Input dispatching timed out (4b6b26a xxx/com.facebook.FacebookActivity (server) is not responding. Waited 5005ms for FocusEvent(hasFocus=true)) HOT 1
- There was a problem using Facebook version 12.3.0 integration login
- Log In with Patreon confirmation HOT 1
- Automatic event fb_sdk_settings_changed collects private user data
- Different performance when share the same link by web or native handler.
- Is somebody here from Facebook to solve almost 8 years old serious bug??? Your (and our) users are really angry https://github.com/facebook/facebook-android-sdk/issues/1216 HOT 1
- Use CustomTabActivity to open Fallback Feed Link to fix Embedded WebView Error HOT 1
- SDK impacted by CVE-2022-25647
- SDK should use isDebugEnabledField instead of BuildConfig.DEBUG
- Feature Request: external_id HOT 1
- Invalid Signature HOT 2
- Login for business
- Profile Pic HOT 2
- Please allow indie developers to impelement Facebook Login without business verification
- Facebook SDK is not adding necessary manifest queries/intents for results from PackageManager.getActivityInfo.
- Important paper's
- SDK show WebView login instead of bring the Facebook App to share my content
- Facebook Deferred DeepLink is not working anymore
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from facebook-android-sdk.