summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Android
diff options
context:
space:
mode:
authorBradChase2011 <brchase07@yahoo.com>2017-03-24 16:12:45 -0400
committerRui Marinho <me@ruimarinho.net>2017-03-24 20:12:45 +0000
commit349969f432ab0a85844d56b26d664beffb6f8a05 (patch)
treed204d6dd1f1269271de0e36b626c978eee3abd70 /Xamarin.Forms.Platform.Android
parent27de335bf1ce9195e7b1de7ec738176da92b3617 (diff)
downloadxamarin-forms-349969f432ab0a85844d56b26d664beffb6f8a05.tar.gz
xamarin-forms-349969f432ab0a85844d56b26d664beffb6f8a05.tar.bz2
xamarin-forms-349969f432ab0a85844d56b26d664beffb6f8a05.zip
Bz53803 Android app crashes during initialization due to invalid cast of toolbar TextView. (#835)
Diffstat (limited to 'Xamarin.Forms.Platform.Android')
-rw-r--r--Xamarin.Forms.Platform.Android/Platform.cs12
1 files changed, 10 insertions, 2 deletions
diff --git a/Xamarin.Forms.Platform.Android/Platform.cs b/Xamarin.Forms.Platform.Android/Platform.cs
index c2bb007e..309ea321 100644
--- a/Xamarin.Forms.Platform.Android/Platform.cs
+++ b/Xamarin.Forms.Platform.Android/Platform.cs
@@ -852,8 +852,16 @@ namespace Xamarin.Forms.Platform.Android
int actionbarId = _context.Resources.GetIdentifier("action_bar", "id", "android");
if(actionbarId > 0)
{
- var toolbar = (Toolbar)((Activity)_context).FindViewById(actionbarId);
- actionBarTitleTextView = (TextView)toolbar.GetChildAt(0);
+ Toolbar toolbar = (Toolbar)((Activity)_context).FindViewById(actionbarId);
+
+ for( int i = 0; i < toolbar.ChildCount; i++ )
+ {
+ if( toolbar.GetChildAt(i) is TextView )
+ {
+ actionBarTitleTextView = (TextView)toolbar.GetChildAt(i);
+ break;
+ }
+ }
}
}
else