TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Chozarajan p
NA
9
591
The Context was not cast into Activity for latest Xamarin
Jul 6 2018 2:11 AM
Hi All,
I have created a new simple Dot Net project with a separate UI and ViewModel project for Android. I have used a simple Xamarin.Android EditText control to rendered in Forms control. In some scenarios, I will handle the keyboard manually. So I have used the below codes to handle the keyboard. But the Context was not cast to Activity. The specified case was not found exception has occurred.
Window window = ((Activity)
this
.Context).Window;
InputMethodManager mgr = (InputMethodManager)((Activity)
this
.Context).GetSystemService(Context.InputMethodService);
if
(window !=
null
)
{
window.SetSoftInputMode(SoftInput.StateHidden);
mgr.HideSoftInputFromWindow(
this
.WindowToken, 0);
}
I have attached the simple project to this post. Please help me to use the keypad manually.
Thanks in advance.
Attachment:
SampleWithSource.zip
Reply
Answers (
0
)
How to set transaction charges % on payment gateway
Execution Timeout Expired.