MVVMCross w/ Bugsense causes weird issues with binding EditText on Android - xamarin.android

I ran into a very weird situation when I installed the BugSense package on my MVVMCross app. Every time I type a letter into the EditText the cursor moves to the first character. This is highly annoying as I have to arrow over to the end of the field to type the next character!
What I did was on the override of the "OnCreate" of my SplashScreenView I set up this:
protected override void OnCreate(Bundle bundle)
{
BugSenseHandler.Instance.InitAndStartSession(new ExceptionManager(), ApplicationContext, "xxxxxxxx");
base.OnCreate(bundle);
}
When my splash screen goes away it moves to my LoginViewModel. My axml for my Login View looks like so:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/white_full_box">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerHorizontal="false"
android:layout_centerInParent="true"
android:layout_marginBottom="#dimen/table_margin"
android:layout_marginLeft="#dimen/table_margin"
android:layout_marginTop="#dimen/dialog_margin"
android:padding="#dimen/zero"
android:background="#drawable/white_full_box">
<EditText
android:id="#+id/username"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/password"
android:layout_centerHorizontal="true"
android:layout_marginBottom="40dp"
android:ems="10"
android:hint="username"
android:layout_marginLeft="#dimen/table_margin"
android:inputType="textVisiblePassword"
android:singleLine="true"
local:MvxBind="Text UserName">
<requestFocus />
</EditText>
<EditText
android:id="#+id/password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:ems="10"
android:hint="password"
android:layout_marginLeft="#dimen/table_margin"
android:inputType="textPassword"
local:MvxBind="Text Password" />
<Button
android:id="#+id/loginButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/password"
android:layout_centerHorizontal="true"
android:layout_marginTop="40dp"
android:layout_marginRight="#dimen/dialog_margin"
android:text="Login"
style="#style/ButtonStyle"
local:MvxBind="Click LoginCommand" />
</RelativeLayout>
</RelativeLayout>
And I just have normal properties that bind to the Username, Password and Login button in the view model. I did a couple things to verify this behavior:
1.) I left the bugsense initialization code and removed the Text bind from the username. In this scenario the username would behave properly but the password field would always move the character to the first character after each text entry.
2.) I reimplemented the text bind to the username field and then commented out the BugSense initialization code and everything appeared to work correctly again.
What is happening here? Where should I be doing the BugSense initialization in an MVVMCross app?

My solution was to switch to Raygun.io because that does not appear to have the same issue.
Bugsense does appear to be looking into the issue which you can follow along HERE

Related

Add button on Sliding Tab Layout fragment android xamarin

I want to add a RecyclerView and button inside FragmentLayout1 in slide tab bag.
I made the following attempt, but the RecyclerView and button appeared with all tabs and not a specific tab. In addition to stopping the application when adding a pressure event to the button.
FragmentLayout1.axml
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerView"
android:scrollbars="vertical"
android:layout_width="fill_parent"
android:layout_height="341.0dp" />
<FrameLayout
android:id="#+id/buttonPanel"
android:layout_width="162.5dp"
android:layout_height="50dp"
android:layout_gravity="top|end"
android:layout_marginEnd="0dp"
android:layout_marginRight="0dp">
<Button
android:text="Button"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minWidth="25px"
android:minHeight="25px"
android:id="#+id/button1" />
</FrameLayout>

Clicking btn calling snackbar causes crash

Firstly, this is my first time trying Xamarin (SDK Tools 26.1.1, SDK Platform Tools 28.0, SDK Build Tools 27.0.0)
Without any amendments to the sample code, the FloatingActionButton successfully displays the Snackbar.
But after experimenting, I discovered if I add an ID to the sample TextView, the Snackbar triggered by the FAB causes a crash.
Why is that so? How can I overcome this? i.e including ID without crash
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:id="#+id/textView1"
android:text="Hello World!" />
Thanx & Rgds,
ref
Dialog on VS:
Unhandled Exception:
Android.Views.InflateException: occurred
Dialog on device:
[appname] has stopped
open app again
[add entire file as requested]
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:showIn="#layout/activity_main">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:id="#+id/textView1"
android:text="Hello World!" />
</RelativeLayout>

#region in axml file for xamarin.android

hello I am trying to make my code in the axml file more readable I have a lot of switches in my program and I want to shrink this part of the code. I read something about it and I found
<!--#region Name-->
My Code
<!--#endregion-->
But it is referred as a normal comment. Could you help me out? I am using Visual Studio 2017 in case it is important to mention.
# region in axml file for xamarin.android
If you want to make the .axml file more readable, you could click the indent button: Effect.
Or you could use the <include/> tag embed another layout inside the current layout to make it more readable. For example, create a titlebar.axml:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/titlebar_bg"
tools:showIn="#layout/activity_main" >
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/gafricalogo" />
</FrameLayout>
Use it in another layout file:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/app_bg"
android:gravity="center_horizontal">
<include layout="#layout/titlebar"/>
<TextView android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/hello"
android:padding="10dp" />
...
</LinearLayout>
Update:
I think the XAML Regions is what you are looking in your .axml file.
Update 2:
Install this plugin for your Visual Studio, close all your Visual Studio windows and reopen the VS. Then, you could the the #Region function for your
<!-- Region (Any Text You Want) -->
Your Code
<!-- EndRegion -->

Floating hint textbox does not show up correctly

I have a textbox with the following AXML code:
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Gebruikers naam"
local:MvxBind="Text UserName"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
The problem is that if the text box is filled on startup(which happens when someone has logged into the app before) the text box shows up like this:
But it has to show up like this:
What am I doing wrong?

How to use multiline textview with scrollbars in monodevelop/monoandroid

I am new in monodevelop/monoandroid.I need code for showing multiline text in textview I have tried bellow but still its not working.I think there should be some code that I have to include in .cs file,but I am not getting what to use there.
I have used c# code also but its not working. I think ellipsize is a android attribute thats why its not working.Please give me some solution.
<ScrollView
android:id="#+id/scrollView2"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_margin="10dip"
android:orientation="vertical"
android:layout_gravity="center" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:layout_marginTop="10dip">
<TextView
android:id="#+id/tv_policy1"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:text="Terms of Service O-job Information Terms of Service O-job Information Terms of Service O-job Information Terms of Service O-job Information for Personal non-commercialaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaa aaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaa use only sdfjkj asdfjklfj sdfjkljdf sdfjkljflkj sdfskjfkl sdfjklsdjf sdfkljsdklfj sdfjhsdkfh"
android:textColor="#000000"
android:maxLines="3"
android:singleLine="false"
android:textSize="14dip" />
</RelativeLayout>
</ScrollView>
Please advice....
Thanks in advance!
Try this format:
<ScrollView>
<RelativeLayout>
<TextView/>
<TextView/>
<RelativeLayout/>
<ScrollView/>
Then you can use the align methods given in a RelativeLayout.
Edit:
Explain what your problem is! Do you get an error when compiling or is the text not shown properly? Be more specific.
Also, why do you use attributes like : android:maxLines="3" or android:singleLine="false" or android:layout_height="60dip" in your TextView. Translated this means: The text must have more than one line but a maximum of 3. Also it can't be longer than 60dip.
Depending on the Text that are very strict rules. Use these rules android:layout_width="match_parent" android:layout_height="wrap_content" to make sure that the text can be displayed correctly, remove the attributes I mentioned before in your TextView.

Resources