Creating a Softkeyboard with mono

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Creating a Softkeyboard with mono

JLee
Is it possible to create a Softkeyboard with mono?
for now, i'm experimenting with the Softkeyboard-Example from google.
but it would be nice to have this in mono, too.
maybe there is already samplecode out there?
i couldn't find something about that, yet.

Lee
Reply | Threaded
Open this post in threaded view
|

Re: Creating a Softkeyboard with mono

ChrisNTR
Hi Lee,

There's an example of a custom softkeyboard in Mono for Android here that you might find useful: http://dl.dropbox.com/u/90453/CustomKeyboard.zip

I hope this helps,

ChrisNTR

On Fri, Jul 13, 2012 at 1:57 PM, JLee <[hidden email]> wrote:
Is it possible to create a Softkeyboard with mono?
for now, i'm experimenting with the Softkeyboard-Example from google.
but it would be nice to have this in mono, too.
maybe there is already samplecode out there?
i couldn't find something about that, yet.

Lee

--
View this message in context: http://mono-for-android.1047100.n5.nabble.com/Creating-a-Softkeyboard-with-mono-tp5710871.html
Sent from the Mono for Android mailing list archive at Nabble.com.
_______________________________________________
Monodroid mailing list
[hidden email]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid



--
ChrisNTR
Microsoft ASPInsider
http://weblogs.asp.net/chrishardy
http://twitter.com/chrisntr

_______________________________________________
Monodroid mailing list
[hidden email]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
Reply | Threaded
Open this post in threaded view
|

Re: Creating a Softkeyboard with mono

JLee
Thanks Chris, this helped me a little bit to understand the whole thing.
But what I want to have is an standalong Softkeyboard which runs in the OS like the standard-softkeyboard from Android. Last night i ported some of Google's code from their softkeyboard-sample into a C# Project.

I did the following:
- Created a class that inherits from InputMethodService.
- Created a class that inherits from Keyboard
- Created a class that inherits from KeyboardView
- Copied the ressource-files (xml-files for keyboardlayout, etc.)

Now, the question is, how to run this project?
I dont get any compile-errors (what means nothing, i know ;))
but mono wants to have the main-activity to start.
i thought, mono maybe gets the information from the manifest-file, that this project is an ImputMethodService, but it doesn't.

maybe there is something missing or in it?! here it is:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="de.osk.smart.keyboard.android" android:versionCode="1" android:versionName="1.0">
  <uses-sdk android:targetSdkVersion="14" />
  <application android:label="OSK Smart Keyboard">
    <service android:name="OSKSmartKeyboard" android:label="@string/ime_name" android:permission="android.permission.BIND_INPUT_METHOD">
      <intent-filter>
        <action android:name="android.view.InputMethod" />
      </intent-filter>
      <meta-data android:name="android.view.im" android:resource="@xml/method" />
    </service>
  </application>
</manifest>

this is the original code from google:
http://www.java2s.com/Code/Android/User-Event/Exampleofwritinganinputmethodforasoftkeyboard.htm

If it is needed i will upload the whole sourcecode. Let me know.
thankful for every hint!
Lee
Reply | Threaded
Open this post in threaded view
|

Re: Creating a Softkeyboard with mono

JLee
have to push this thread a little bit, cause im stucking at this problem and can't get further.
does anybody know, whicht project-type /-settings I have to use, to say mono, that this is an InputMethodService (or if it is possible to create IME-Projects with mono, anyway)?

I think in Java, Android gets this informatinen from the manifest-file.
But in mono this doesn't seem to work.

Lee
Reply | Threaded
Open this post in threaded view
|

Re: Creating a Softkeyboard with mono

Jonathan Pryor-2
On Jul 17, 2012, at 5:47 AM, JLee wrote:
> does anybody know, whicht project-type /-settings I have to use, to say mono, that this is an InputMethodService (or if it is possible to create IME-Projects with mono, anyway)?

InputMethodService is a Service, so you should use the [Service] custom attribute:

        http://androidapi.xamarin.com/?link=T:Android.App.ServiceAttribute
        http://docs.xamarin.com/android/advanced_topics/working_with_androidmanifest.xml

 - Jon

_______________________________________________
Monodroid mailing list
[hidden email]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
Reply | Threaded
Open this post in threaded view
|

Re: Creating a Softkeyboard with mono

JLee
This post was updated on .
thanks for the info, that brought me further. I have added the following attributes to the InputMethodService:

[Service(Name = "osksmartkeyboard.OSKSmartKeyboard", Label = "OSK Smartkeyboard", Permission = "android.permission.BIND_INPUT_METHOD")]
[IntentFilter(new string[] { "android.view.InputMethod" })]
[MetaData("android.view.im", Resource = "@xml/method")]

But it seems, that it is not possible to run a service-project direct from debugger, isn't it? When I start the project, mono still wants to have a main-activity. But when I choose build/deploy the apk is copied to the device and there I can choose it as input-method. for now, my keyboard doesn't appear -> need to debug.

what is the best practice to debug a service-project in mono? Does someone has a hint or a link, where i can get the information?
Reply | Threaded
Open this post in threaded view
|

Re: Creating a Softkeyboard with mono

thuat
In reply to this post by ChrisNTR
Hi Chris

Do you know how to enable long press event in keyboardview?

Br/Thuat