How to create a custom keyboard that looks like the standard one - java

I am experimenting with custom ime on android. The sample SoftKeyboard app seems to show everything I need except how to make the keyboard look like the standard one (colors, hover effects, sizes etc.).
It seems like reusing resources from the standard keyboard sources could work, but I receive errors when trying to compile them like:
error: Error: No resource found that matches the given name: attr android:layout_alignParentStart'.
Commenting these errors produce lots of other XML errors, like:
error: No resource identifier found for attribute 'additionalMoreKeys' in package 'com.android.inputmethod.latin' key_f1.xml
Is there some semi automatic a way to fix these errors and make them compile?
I have got the sources from here: https://android.googlesource.com/platform/packages/inputmethods/LatinIME/+/android-4.4.2_r2
Thanks in advance.

That depends on your purpose.
If you want to create keyboard specifically to any activity then follow below tutorial.
http://tutorials-android.blogspot.in/2011/06/create-your-own-custom-keyboard-for.html
Or if you want to create keyboard that will replace default keyboard in all applications then following answer will be helpful to you.
https://stackoverflow.com/questions/14806087/android-facebook-emoji-keyboard/14826813
As you said you want to change layout of keyboard then read this.

You could browse the android source code: android.inputmethodservice.KeyboardView and
android.inputmethodservice.Keyboard and look for the specific behaviour you want.

The keyboard found in android is open source, along with most of the other packages found in the OS. You can see the code here: https://android.googlesource.com/platform/packages/inputmethods/LatinIME/+/android-4.4.2_r2

Related

Is there any way to add Autocorrect to my Android Keyboard?

I am working on an Android Keyboard, and I was trying to see if there was any way to add in Autocorrect into it. Or is Autocorrect provided with the Spelling Checker Framework? I cannot find a clear cut answer anywhere on here or any other place that I have looked.
My code for my keyboard can be found here > https://github.com/MJonesDev/AndroidKeyboardPractice
You can't rely on the Spellchecker framework. It isn't included on all devices- specifically Samsung ones. (Which may be my fault- when I worked at Swype and 4.0 was new, its UI was interacting badly with Swype. I asked them to turn it off by default, they decided to remove it entirely).
Even when it exists it doesn't really provide autocorrect. At best it can give you possibilities, and its then your job to display them, and handle the text correction when one is chosen.
There are various spelling correction libraries out there of different qualities. Its possible to find open source ones to include if you aren't looking to do anything special.

Android google repository - keyboard

guys, I'm looking for the source of the official android keyboard code but whenever I find in the official repositories, it is always with missing classes. I wonder where I can find the source (which is open), this terclado to be able to create and modify it and that works in versions 2.2 to the last.
I want to create an application where I can customize the layout with specific colors, etc. audio inputs and the like.
They could help me? I know it's maybe my question is not appropriate but do not give negative to block my account.
I just want to know where I can get the full source google Keyboard customize for me, but whenever I think, is missing classes at SRC.
thanks
Repos you can use
AnySoftKeyboard.git
LatinIME
A quick and concise google search is all you need to get what I just got. The first one is open source so it should be properly documented. The second one has a weird layout, but I don't use Google Source, so I wouldn't know how well it works/functions.

Add a custom file type with java application installation

I am trying to have my custom file type .vrs (which for all intents and purposes is an rich text format).
I am pleased with what I have since I am self taught.
But am having difficulties associating that file with my program so that when a user double clicks it, it automatically open my document editor.
All searches so far have come up with either right clicking and setting the association, but this is not what I would need.
I may not have explained as well as needed so think Photoshop's .psd when you install Photoshop all psd files are automatically set to open when you double click them.
Hopefully I have been clear enough for you to help.
Also whilst the question is regarding Java any resource be it for C# C++ etc, would also be appreciated.
Thanks for your time and any responses.
This functionality is system dependent, and in Windows involves the registry. If you really want to delve into this, take a look at this post, which goes into great detail on how to accomplish programmatically setting a file extension association using C++. If this is helpful, please write back telling us how you solved the problem in your individual situation.
If that isn't helpful I would try this link instead, as it links to more resources and demonstrates a little C# code.

Netbeans refuses to auto suggest known classes for imports

I just discovered that my NetBeans suddenly stops importing classes that are found in the Java API but can still import classes from my external libraries. Take a look at the image below:
As you can see, List and ArrayList are classes from the java.util package but the usual suggestions for importing them are not shown here, instead it is asking me to create class. I know that I can type import java.util.List; on the top of the code but life was better before! Please I need help thanks.
I had the same problem a couple minutes ago... Terrible. The same problem has been reported here:
Bug 235712
The solution which I've found there was sufficient - simply delete the Netbeans cache...
In order to do this, go to Help ==> About . Then go to the directory with cache and delete all you find in the "index" catalog.
After restarting the NB, everything was cool.
Today I came across the same problem. It happens that it actually is very easy to exclude a class from code completion if you click in the wrong place while working.
To solve it (netbeans 8.2) go to
Tools - Options -> Editor tab
Then select Code Completion Tab
In the drop Down select JAVA (in my case it was Java)
You will find a box bellow titled Package/Classes
In the EXCLUDE tab you probably will find the packages marked to be excluded from code completion. Just remove the ones you want back.
Check under Preferences->Editor->Code Completion to make sure auto complete is on, though by your screen shot I assume that it is.
Also try Preferences->Editor->Formatting and set your Language to Java
In my case, NetBeans was refusing to suggest Scanner. As it turned out, all I had to do was remove java.util.Scanner from Options » Editor » Code Completion » Packages/classes: » Exclude. Then the autocompletion for Scanner returned.

Eclipse plugin "Operation not enabled"

I'm struggling with Java Refactoring - I need to write an Eclipse plug-in which will refactor some code. It's really difficult for me and it would be way easier if I could follow working code step - by - step. The only alike example I could find is a sample Introduce Indirection.
Unfortunately I cannot make it actually work. I get "chosen operation is not currently available" information anytime I try it.
I've imported code, "Run As -> Eclipse App" and than tried to use Introduce Ind. from Eclipse Articles. What am I doing wrong?
I'll be happy with any help :).
Check your handler class for isEnabled() method. I suppose when creating new handler the default value for this method returns false. That can be the issue.
You should be able to get that example (as written) working, or perhaps you need to open a bug. When you start their example in Run As, is there any errors in your error log?
Something else you can try is to look at some of the workbench refactorings. See org.eclipse.ltk.internal.ui.refactoring.actions.MoveResourcesHandler which sets up the move resources refactoring, and http://wiki.eclipse.org/FAQ_How_do_I_find_a_particular_class_from_an_Eclipse_plug-in%3F if you need help tracking down the SDK classes using CTRL+SHIFT+T
I've managed to run it. For others who'll face the same problem:
Check the basics:
Remember that you can chose only one method and:
It must exist in the model (http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.jdt.doc.isv/reference/api/org/eclipse/jdt/core/IJavaElement.html)
It must not have any errors
Must not be a constructor
Must not be connected to annotation declaration
And:Select a Java method in the editor outline or the Package Explorer
And it gets obvious :)
The action handler class should be impediments with related interfaces (Check for error console for identify what are the missing interfaces, most probably this would be 'IActionDelegate').

Categories