I need to develope android keyboard app, but Android developers website tells that KeyboardView and Keybord classes are deprecated after Api 29, to create the UI for the keyboard.
This class was deprecated in API level 29. The following is the message I found:
This class is deprecated because this is just a convenient UI widget class that application developers can re-implement on top of existing public APIs. If you have already depended on this class, consider copying the implementation from AOSP into your project or re-implementing a similar widget by yourselves
So how shall I develope the app if the classes won't work after Api 29? Any suggestion?
The only solution Google suggests is copying KeyboardView.java and Keyboard.java files to your local project from Android AOSP. With some customization I managed to make it work as old deprecated KeyboardView and Keyboard Android's classes.
You will also have your local copy of com.android.internal.R attributes (stylable) from from here
You can notice, it is annotated as
<!-- {#deprecated Copy this definition into your own application project.} -->
Related
KeyboardView has been deprecated official by android team in API level 29 and i didn't able to find the alternative way for this. Please let me know if there any alternative?
The only solution Google suggests is copying KeyboardView.java and Keyboard.java files to your local project from Android AOSP. With some customization I managed to make it work as old deprecated KeyboardView and Keyboard Android's classes.
You will also have your local copy of com.android.internal.R attributes (stylable) from from here
You can notice, it is annotated as
<!-- {#deprecated Copy this definition into your own application project.} -->
Google:
This class was deprecated in API level 29. This class is deprecated
because this is just a convenient UI widget class that application
developers can re-implement on top of existing public APIs. If you
have already depended on this class, consider copying the
implementation from AOSP into your project or re-implementing a
similar widget by yourselves
I see this github projects:-
https://github.com/rkkr/simple-keyboard
And
https://github.com/NlptechProduct/Android-Keyboard
but i don't understand code.
Please give me any suggestion or demo And which not use KeyboardView because this is deprecated.
This class was deprecated in API level 29. This class is deprecated
because this is just a convenient UI widget class that application.
Developers can re-implement on top of existing public APIs. If you
have already depended on this class, consider copying the
implementation from AOSP into your project or re-implementing a
similar widget by yourself.
or explain me about android keyboard how can i develop.
or suggest me how can i develop my custom keyboard app.
I am trying to use the class SntpClient that should be in the android.net package, but Android Studio is telling me it cannot find it. Indeed when I look through the source jars (of both API 19 and API 21), the class is not there. However according to grepcode it should be.
http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.4.4_r1/android/net/SntpClient.java
What am I doing wrong?
Google has chosen not to make all public classes available as part of the SDK. Visibility is controlled by the #hide comment tag as described here.
I'm not sure why they chose to hide SntpClient particularly, but provided you respect the terms of the Apache license you can copy the source into your application without much modification.
I am writing my own SDK on android and as such creating my own jar.
Now I create documentation of my SDK using droiddoc tool.
In my framework files(.java), there are many APIs that I have marked with #hide
Now this is the current state:
a) all APIs marked with #hide are hidden in documentation.
b) These APIs marked hidden is INCLUDED in class files in generated jar file.(I use Java decompiler to check this).
Now when I include this jar in eclipse and use Ctrl+space on my class object to find its options, i can see that hidden APIs are actually visible and accessible here.
Am I missing anything here, and do I need to add any special flags in make file? Or is this a normal behaviour?
I found out that:
android.jar has all classes from com.android.internal removed, and all
classes, enums, fields and methods marked with #hide removed as well
So the classes with #hide are not included on jar -> that's why they are not accessible in eclipse.
Furthermore:
When you launch your application on device it loads framework.jar
(roughly this is equivalent of android.jar on the device) which is
uncut and has all the internal API classes and all hidden API
components.
Have a look over this post and this answer
Hope you find an alternative solution for hiding things
I'm trying to (correctly) implement a preferences screen, but the problem is that all the methods used to read preferences from xml files are deprecated (or I just don't recognize them). The official sample code on the dev site (PreferenceActivity) uses deprecated methods. Has anyone found out a way to implement a preferences screen with an xml file but without using either: addPreferencesFromResource(int) or findPreference(CharSequence)? Or have the methods just been marked deprecated without implementing the alternative yet?
EDIT: Developing for Android version 2.1
Why its deprecated and what is the alternative is pretty well explained in documentation:
This is the base class for an activity to show a hierarchy of preferences to the user. Prior to HONEYCOMB this class only allowed the display of a single set of preference; this functionality should now be found in the new PreferenceFragment class. If you are using PreferenceActivity in its old mode, the documentation there applies to the deprecated APIs here.
In other words, if you want to be HONEYCOMB compliant, then you should use PreferenceFragment for your PreferenceActivity. A detailed explanation on how to use fragments can be found in dev guide.
In Android 3, API Level 11, the fragment-based preference model was introduced, thus deprecating methods that "is not relevant for a modern fragment-based PreferenceActivity."
Since the online reference is the latest version, it shows the methods as deprecated. By manipulating the API Level dropdown, you can mark the methods that are not in the given Android version, but it doesn't update the descriptions to match, which is why it still shows up as deprecated.
If you don't plan on supporting Android 3+ you should just use the old methods, as the fragment-based solutions will not work to versions prior to this.