Hi All,
I cracked open Remote Spy++ and started figuring out how I could go about writing a Honeycomb start menu replacement for WM5-6.1 (seen the XP Start Replacement? Same idea). Having written something similar on desktop Windows I thought it would be easy. The app is in C#/CF.
So the window hierarchy is:
Code:
- Desktop
- HHTaskBar
- (nothing !!!)
And messages of interest (in order):
Code:
WM_LBUTTONDOWN (0x201)
WM_PAINT (0xF)
WM_INITMENUPOPUP (0x117)
Okay, so forgetting about the fact that the window is opaque (I will delve into this later on), I went ahead and subclassed it to catch the WM_LBUTTONDOWN message (the others didn't stop the original from showing up). That falls over (the debugger doesn't even break into code and the device needs a hard reset). I am investigating this - although my MessageBox shows up just before it dies.
Update: Using BeginInvoke with a worker method fixes the above issue. E.g:
Code:
public IntPtr NewWndProc(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam)
{
if (msg == WM_LBUTTONDOWN)
{
this.BeginInvoke(new Action(DoWork));
return IntPtr.Zero;
}
return CallWindowProc(oldWndProc, hWnd, msg, wParam, lParam);;
}
private void DoWork()
{
Form2 two = new Form2();
two.Show();
}
So my question: the HHTaskBar is opaque, it has no child controls. Obviously, I don't want to subclass the battery/close/etc. buttons, and ideas on how to reliably retrieve the rect for the start button?
Or is the whole thing a hack? I suspect there is a way to do this without all this subclassing hackery. Google and forum search didn't turn up anything.
Thanks guys.
Source code
Usage: (not recommended on real device - use an emulator!) Click on button1 then click anywhere on the taskbar. Now reboot
I'd start with Quickmenu:
http://forum.xda-developers.com/showthread.php?t=471292
This app is the best start menu replacement I ever saw...
I'd only add a mixture of WKTASK's taskbar management and the ability to choose a icon for the start menu.
Thanks
twolf said:
I'd start with Quickmenu:
http://forum.xda-developers.com/showthread.php?t=471292
This app is the best start menu replacement I ever saw...
I'd only add a mixture of WKTASK's taskbar management and the ability to choose a icon for the start menu.
Click to expand...
Click to collapse
Thanks, it doesn't look like he has any source code available though. Looks like I will have to investigate more... I am not going for the drop down style (but as you said, it is really cool), I am trying to make a Honeycomb (WM 6.5) style menu.
I tried the wm6.5 honeycomb start menu... was not impressed, but maybe it had some extra something i didnt noticed... :/
I still haven't flashed my device with 6.5, but I reckon a FOSS honeycomb menu could be cool...
I think you'r on to something here. The start menu as it is in WM6.1 is pretty much useless. I would much rather have the start menu show me a application shortcut page like the one in WM6.5. Although to be honest I don't really like the honeycomb look. What's wrong with a plain old columns and rows type of thing. With the added physics scrolling/swiping stuff of course
frepe383 said:
I think you'r on to something here. The start menu as it is in WM6.1 is pretty much useless. I would much rather have the start menu show me a application shortcut page like the one in WM6.5.
Click to expand...
Click to collapse
Exactly! I am also hoping to replace that shoddy settings menu.
frepe383 said:
Although to be honest I don't really like the honeycomb look. What's wrong with a plain old columns and rows type of thing. With the added physics scrolling/swiping stuff of course
Click to expand...
Click to collapse
I think something with tabs (like Manila 2D) such as 'Programs', 'Running Programs', 'Settings' would be pretty useful. Skinning is a given, and honeycomb would be one (for the fanatics).
Update
I decided to call the tool Mead (as in the beer that contains honey ).
I was having problems with the default message pump and the hook (well, subclassed event). I am not sure which message was crashing my program, but if I use Application.Run() a native exception occurs in mscoree3_5.dll. The workaround is to create the form in the handler for the hook and show that one (it wasn't a UI thread being called from a worker, I am aware of that). So I think it must be a CF message pump bug. In any case, it works great now.
Quitting isn't all the way there yet, still some bugs (the type that will need a soft reset).
On to the UI stuff.
clickety
Excellent idea mate, but is it worth doing? the Beta 2 of 6.5 is already out and i am guessing its not long until the final version
Any news on this?
Nope
Nothing new. Just haven't had time between my job.
For now I am pinning it as the native call-in issue that the .Net CF suffers from (a documented limitation). Something isn't quite right.
I will continue to experiment, but push comes to shove, I will probably land up creating an interop library for it.
Instead of subclassing, you can just create a childwindow of HHTaskbar that is located over the start button.
Alternatively, you could suPerclass the "Explore" window class just to replace the Programs menu. Beware, that superclassing may be a bit dangerous
Interesting Idea
That is an interesting idea. When I get time I will start messing around with it.
That said I do expect some problems: again the interop call-in to .NET CF, but this may prove to work as a work-around .
Hi Community,
I have a problem with implementing a menu, which should show up if the user presses the Menu-Button on his device. I followed the Dev Guide on developers.android.com and Overrode the onCreateOptionsMenu-Method, but if I press the Menu-Button on my VirtualDevice or my real Device, the Menu doesn't show up
Then I tried it the Not-XML-Way and implemented the onCreateOptionsMenu-Method like this:
Code:
public boolean onCreateOptionsMenu(Menu menu) {
menu.add(0,1,0,"Edit Contact");
menu.add(0,2,0,"Settings");
menu.add(0,3,0,"Exit");
return true;
}
But the menu still doesn't show up when I press the menu-Button.
I ensured via the debugger that the onCreateOptionsMenu is executed!
Anybody an idea what circumstance could prevent the showup of my menu?
I append my whole Javaclass if somebody could be that kind and would take a look, that would be very nice
Cheers
LordAlien
ps.: If somebody want to get an overview of this project I maintain it via git and have a gitweb frontend installed. Its located here http://aliens.homelinux.org/git/?p=rifle.git;a=summary
No one an idea what part of my code could influence the show up of my menu?
Every hint is highly appreciated!
This morning I had the helping flash of genius. I forgot to update the onKeyUp-Method, I only modified the onKeyDown-Method.
Now it works as expected
Always nice to see someone post when they solve it themselves.
Sent from my HTC Desire using XDA App
Hi devs,
During development of my app (see my signature), I researched a bit and finally found a quite nice way to implement a custom keyboard which is only shown in your app easily.
Much of this is taken from Maarten Pennings' awesome guide here, thanks to him and feel free to read it as well.
So I thought I'd extend his work with this guide which also takes a look at why you'd want to use one or the other keyboard. Enjoy! :victory:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Limits of the Android IME
Any kind of text input (password, number, address, etc.) is usually handled very nicely using the android:inputType attribute (or the corresponding setter in java) on the EditText field.
But as soon as you have to deny some characters, for instance you want the user to insert a file name, it gets more complicated since there is no inputType for that.
The way to achieve that would be to implement your own KeyListener like this:
Java:
import android.text.method.NumberKeyListener;
//...
// set a new KeyListener onto your desired EditText, overriding the default one:
EditText edit = findViewById(R.id.edittext);
edit.setKeyListener(new NumberKeyListener(){
@Override
public int getInputType() {
// should be the same as android:inputType, for all numbers including decimal and negative:
return (InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL | InputType.TYPE_NUMBER_FLAG_SIGNED);
}
@Override
protected char[] getAcceptedChars() {
// declare your desired chars here, ONLY those will be accepted!
// for instance numbers:
char [] res = {'1', '2', '3',
'4', '5', '6',
'7', '8', '9',
'0', '+', '-', '*', '/',
'(', ')', '.', ',', ' ', '^', '!',
// alphabet:
'a', 'b', 'c', 'd', 'e',
'f', 'g', 'h', 'i', 'j',
'k', 'l', 'm', 'n', 'o',
'p', 'q', 'r', 's', 't',
'u', 'v', 'w', 'x', 'y',
'z'
};
return res;
}
});
The problem is that the keys are still present and therefore distracting and irritating to the user, because nothing happens on click.
And also, there might be a much easier and better accessible layout for your set of keys. In the following I will tell you how to integrate such a custom layout using the KeyboardView class, but first let's take a look at the advantages of both keyboards:
Android IME or KeyboardView???
The answer to this question is tightly depending on the task you want the user to fulfil, and also on how much freedom you want to give him. The high customizablility and its theming options are a strong point for the KeyboardView, but be warned that since this View was added in API level 3 (and never updated I think) there are a couple of bugs which you have to workaround.
A standard keyboard is more familiar to the user and is often also a third-party keyboard and therefore more customizable. But this also has its downsides since there is no guarantee that the IME will display the characters you need.
Note that you will not be able to get a working cursor image easily with the KeyboardView (though the cursor works as it should, just the blue arrow below it won't be displayed).
For simple tasks where just a few buttons will be useless, such as when asking for a filename the normal IME is recommended. But for various operations you'll find the KeyboardView to be much cleaner.
If you decided to try the KeyboardView, here's how it works:
Adding a CustomKeyboard
NOTE: I will only cover how to implement such a Keyboard, if you want to know how it works in detail check out the third chapter in Maarten Pennings' guide.
First, since it is a view, you will need to manually insert the following to the xml layout file of all activities where you want to use it:
Code:
<android.inputmethodservice.KeyboardView
android:id="@+id/keyboardview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:visibility="gone" />
Put it in a relative layout container, though it should also work in other ones. Most important is that it is the topmost container in the view hierarchy.
Second, you need an xml file where all the keys and their layout are stored for the KeyboardView to inflate. For a start, you can take the one Maarten Pennings has posted or download mine here: View attachment keyboard_layout.txt (xda doesn't support .xml files, so just rename it to keyboard_layout.xml!)
Move that file to your res/xml/ folder, you can create other layouts for landscape using res/xml-land/
You have to play around with that file a bit to get your desired layout, here are some tips:
Start by designing it on paper, then write it as a comment (ASCII-Art?) so you have it properly lined up and always at your hand while coding
Including gaps of half a key or so to separate different areas works nicely
Highlight important keys either with a different android:keyBackground or by making them larger than the others.
Leave the android:horizontalGap attribute untouched on Keyboard level, this will probably break the key lineup
Calculate the key width like so: width = 100/(keysPerRow + numberOfGaps)
Set the android:keyHeight on Keyboard level to something that rows*keyHeight is about 40%-50%.
For every key label which is longer a single character, use the corresponding ASCII-integer as key code (android:codes), otherwise pick a negative number or one that's higher than 256
Use android:isRepeatable="true" for keys to press and hold for multiple clicks like the delete key
If you want to display a popup keyboard on hold, you should rather make a popup window yourself or use a dialog rather than using the androidopupKeyboard attribute.
For inserting more than one char on click, use the android:keyOutputText on key level or override the specific keycode in the onKey() method in CustomKeyboard.java
As I said, you will need some patience doing this since there is neither help nor documentation on the xml namespaces.
Third, there are a couple of icons required for some keys like the delete key. You can either use the ones provided in the guide, but I suggest downloading the original holo android icons from the different drawable folders here.
Take the sym_keyboard_... files that you think you'll need and place them in the respective res/drawable-ydpi folder. Set the android:keyIcon attribute to @drawable/sym_keyboard_... for those special keys.
Fourth, we need a java class to process the clicks and provide the methods for showing and hiding the keyboard. Luckily, you take mine here: View attachment CustomKeyboard.txt (again, rename it to CustomKeyboard.java)
Copy that file into your src/com/package/name and change the package to your app.
This class is heavily based of the one Maarten Pennings has come up with, but with an actually working cursor, so that you can tap or drag to move the cursor. I included haptic feedback (set it using enableHapticFeedback(true)) and an easy way to add chooser dialogs if you want to have multiple insertions in one key (see the onClick(...) method); This looks like this:
If you are using any special keys or dialogs as popups, you will need to edit the onKey() or the onClick() method like I did.
Fifth, in your onCreate() method after setContentView(...) you just need to register every EditText that you want to use the keyboard on like so:
Java:
// initialize the instance variable customKeyboard
customKeyboard = new CustomKeyboard(this, R.id.keyboardview, R.xml.keyboard_layout);
// register the edittext
customKeyboard.registerEditText(R.id.edittext);
For a hiding keyboard if you press the Back key, add the following to your activity:
Java:
@Override
public void onBackPressed() {
if(customKeyboard!=null && customKeyboard.isCustomKeyboardVisible() ) customKeyboard.hideCustomKeyboard(); else super.onBackPressed();
}
Click to expand...
Click to collapse
Congrats, you have finished adding a CustomKeyboard and can now test and further improve it :good:
Read on if you want to theme it further (let's face it, the default theme is still from the first versions of android).
Theming your Keyboard
Theming the KeyboardView
To make your newly created keyboard fit more to the overall style of your app, it is crucial to theme it.
Here are some attributes which you'll want to customize:
Code:
<!-- on KeyboardView level: (in android.inputmethodservice.KeyboardView in your activity) -->
android:keyBackground
android:keyTextColor
android:keyTextSize
android:background
<!-- on Key level: -->
android:isSticky
<!-- for toggle keys like shift or ALT only -->
android:isModifier
These are all pretty self-explanatory, the most important one being the keyBackground.
You will need different drawables for each of the keys states including normal, pressed, active, popup and either light or dark theme.
As an example, here's how I made the holo style: Basically I took the holo drawables from source and added android:keyBackground="@drawable/btn_keyboard_key_ics" in our KeyboardView (not Keyboard!).
Download those icons from here.
Specifically, you need the btn_keyboard_key_ics.xml file in the drawable folder and all the btn_keyboard_key_... from the xhdpi, hdpi and mdpi folder that you need, at least btn_keyboard_key_dark_normal_holo and btn_keyboard_key_dark_pressed_holo.
The btn_keyboard_key_ics.xml goes into your res/drawable folder and all the others should be dumped into their respective res/drawable-ydpi folder.
From the key_ics file delete all items where you didn't download the .9.pngs so they don't give compilation errors.
Click to expand...
Click to collapse
I hope you found this helpful and I could save you a bit of work. If you have any questions or suggestions, feel free to post them here!
This guide was featured on the portal on 26th October (thanks Will Verduzco!)
Wow. Really cool guide. :good:
Can we edit the third party stock keyboards....
SimplicityApks said:
Theming the KeyboardView
To make your newly created keyboard fit more to the overall style of your app, it is crucial to theme it.
I hope you found this helpful and I could save you a bit of work. If you have any questions or suggestions, feel free to post them here!
This guide was featured on the portal on 26th October (thanks Will Verduzco!)
Click to expand...
Click to collapse
Since i like the stock keyboard of htc one ... just wanted to know if i replace the resources of stock keyboard of AOSP with that of keyboard from
htc one will it work or do i nedd to do some modding....
anurag.dev1512 said:
Since i like the stock keyboard of htc one ... just wanted to know if i replace the resources of stock keyboard of AOSP with that of keyboard from
htc one will it work or do i nedd to do some modding....
Click to expand...
Click to collapse
You mean you want to have a KeyboardView in your app with the layout files from the HTC keyboard? Sure, that'll work, you only need to get the resources (decompile keyboard app?). Some layout adjustments might be needed of course...
reply
SimplicityApks said:
You mean you want to have a KeyboardView in your app with the layout files from the HTC keyboard? Sure, that'll work, you only need to get the resources (decompile keyboard app?). Some layout adjustments might be needed of course...
Click to expand...
Click to collapse
no bro i m saying to mod the stock keyboard of jellybean with that of stock keyboard of htc one...
anurag.dev1512 said:
no bro i m saying to mod the stock keyboard of jellybean with that of stock keyboard of htc one...
Click to expand...
Click to collapse
OK, sorry, I didn't read the title of your post...
That should be possible, although I have no idea about decompiling and modding. From what I understand, you could try making an XPosed module, that should work and is better since it can be applied at runtime.
SimplicityApks said:
Hi devs,
During development of my app (see my signature), I researched a bit and finally found a quite nice way to implement a custom keyboard which is only shown in your app easily.
Much of this is taken from Maarten Pennings' awesome guide here, thanks to him and feel free to read it as well.
So I thought I'd extend his work with this guide which also takes a look at why you'd want to use one or the other keyboard. Enjoy! :victory:
View attachment 2347941
Congrats, you have finished adding a CustomKeyboard and can now test and further improve it :good:
Read on if you want to theme it further (let's face it, the default theme is still from the first versions of android).
Click to expand...
Click to collapse
Nice
FunctionCapture
I just released my app to the Play Store, so if you want to see how the CustomKeyboard feels in action, download it here:
FunctionCapture
You might want to leave a review or +1 as well, that helps a lot, thanks!
SimplicityApks said:
Theming the KeyboardView
To make your newly created keyboard fit more to the overall style of your app, it is crucial to theme it.
I hope you found this helpful and I could save you a bit of work. If you have any questions or suggestions, feel free to post them here!
This guide was featured on the portal on 26th October (thanks Will Verduzco!)
Click to expand...
Click to collapse
hi... I am not able to download resources for custom keyboard... please help me
tejal said:
hi... I am not able to download resources for custom keyboard... please help me
Click to expand...
Click to collapse
Well I can still download it, might be a problem with either your browser or xda where you live...
Thanks for the tutorial, really helped me with my project as I need a custom keyboard. But I would like to ask, how do I add a second page to the keyboard as I need more entries to it. Is there a way to add like a small button in the keyboard 1/2 and when you press it, it'll go to the 2nd page of it.
misleading93 said:
Thanks for the tutorial, really helped me with my project as I need a custom keyboard. But I would like to ask, how do I add a second page to the keyboard as I need more entries to it. Is there a way to add like a small button in the keyboard 1/2 and when you press it, it'll go to the 2nd page of it.
Click to expand...
Click to collapse
Mmmmh didn't think about that so far... Have you tried wrapping 2 keyboardviews in a viewpager?
SimplicityApks said:
Mmmmh didn't think about that so far... Have you tried wrapping 2 keyboardviews in a viewpager?
Click to expand...
Click to collapse
I think I got it somehow.
I made a small key in the current keyboard. An example maybe like SYM which represents Symbol, so if you press it, it'll go to the view on keyboard full of symbols. Just had to repeat actually.
Edit: It seems like I can't post the code or part of it. Says that my post was flagged by the system and was blocked from submitting. I want to show how, but it seems it doesn't allow me haha.
misleading93 said:
I think I got it somehow.
I made a small key in the current keyboard. An example maybe like SYM which represents Symbol, so if you press it, it'll go to the view on keyboard full of symbols. Just had to repeat actually.
Edit: It seems like I can't post the code or part of it. Says that my post was flagged by the system and was blocked from submitting. I want to show how, but it seems it doesn't allow me haha.
Click to expand...
Click to collapse
Lol sometimes the system is against us..., well nice you figured it out
I am lost/stuck
First off I would like to thank Simplicity for such a simple guide and tutorial on how to set the custom keyboard up. Secondly even if it was very simple I obviously cannot follow directions and have done something wrong and even though my custom keyboard pops up and I am able to press the button, I am not able to get the edittext field to register the onclicks of the keys thus resulting in the buttons doing nothing. I have pmed Simplicity and was requested by him to post this question in the thread for others in case anyone else runs into this issue.
I have attached both the xml and java file to the post.
Hope someone can help and also hope this problem I ran into will help others if they are stuck at the same place.
Once again a big big big Thanks to SimplicityApks.
kva123 said:
First off I would like to thank Simplicity for such a simple guide and tutorial on how to set the custom keyboard up. Secondly even if it was very simple I obviously cannot follow directions and have done something wrong and even though my custom keyboard pops up and I am able to press the button, I am not able to get the edittext field to register the onclicks of the keys thus resulting in the buttons doing nothing. I have pmed Simplicity and was requested by him to post this question in the thread for others in case anyone else runs into this issue.
I have attached both the xml and java file to the post.
Hope someone can help and also hope this problem I ran into will help others if they are stuck at the same place.
Once again a big big big Thanks to SimplicityApks.
Click to expand...
Click to collapse
Had a look at your class and the xml keyboard layout again and everything seems fine to me so far... Question is how you implemented the keyboard in your activity layout and what happens when you register your text field in the onCreate(). It would be helpful if you could show us these parts of your code.
Other than that, does your onKey() method in the CustomKeyboard get called when you press a key? (Put a Log.d(..) statement or debug stopped in there to find out)
SimplicityApks said:
Had a look at your class and the xml keyboard layout again and everything seems fine to me so far... Question is how you implemented the keyboard in your activity layout and what happens when you register your text field in the onCreate(). It would be helpful if you could show us these parts of your code.
Other than that, does your onKey() method in the CustomKeyboard get called when you press a key? (Put a Log.d(..) statement or debug stopped in there to find out)
Click to expand...
Click to collapse
Hey sorry for the late response I just figured out what the problem was but now I have no idea how to fix it. The problem is here
Code:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="10dp"
android:padding="10dp"
android:descendantFocusability="beforeDescendants"
[COLOR="Red"]android:focusableInTouchMode="true" //This Right here is the problem[/COLOR]
android:weightSum="6" >
<TextView
android:id="@+id/billtotalTV"
android:layout_width="0dp"
android:paddingLeft="25dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:text="Bill Amount:"
android:textColor="#B34F6675"
android:textSize="25sp" />
<EditText
android:id="@+id/et"
android:layout_width="0dp"
android:paddingRight="25dp"
android:layout_height="wrap_content"
android:hint="Enter Total"
android:gravity="center_horizontal"
android:textColor="#049C7A"
android:textColorHint="#B3049C7A"
android:inputType="numberDecimal"
android:imeOptions="actionDone"
android:maxLength="7"
android:textSize="30sp"
android:layout_weight="3"/>
</LinearLayout>
The Reason I have that is because I am trying to avoid my app from setting my EditText as a focus as soon as the activity starts. As far as I am aware I do not know of any other methods that can work around that. Let me know what you think I should do.
kva123 said:
Hey sorry for the late response I just figured out what the problem was but now I have no idea how to fix it. The problem is here
Code:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="10dp"
android:padding="10dp"
android:descendantFocusability="beforeDescendants"
[COLOR="Red"]android:focusableInTouchMode="true" //This Right here is the problem[/COLOR]
android:weightSum="6" >
<TextView
android:id="@+id/billtotalTV"
android:layout_width="0dp"
android:paddingLeft="25dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:text="Bill Amount:"
android:textColor="#B34F6675"
android:textSize="25sp" />
<EditText
android:id="@+id/et"
android:layout_width="0dp"
android:paddingRight="25dp"
android:layout_height="wrap_content"
android:hint="Enter Total"
android:gravity="center_horizontal"
android:textColor="#049C7A"
android:textColorHint="#B3049C7A"
android:inputType="numberDecimal"
android:imeOptions="actionDone"
android:maxLength="7"
android:textSize="30sp"
android:layout_weight="3"/>
</LinearLayout>
The Reason I have that is because I am trying to avoid my app from setting my EditText as a focus as soon as the activity starts. As far as I am aware I do not know of any other methods that can work around that. Let me know what you think I should do.
Click to expand...
Click to collapse
So you mean it works perfectly without the focusableInTouchMode="true"? Strange... Then just leave the focus there and hide the softkeyboard in your onCreate() or is there any other reason you don't to have it in focus except for the soft keyboard popping up? (Then set the focus to another view might be the easiest ).
SimplicityApks said:
So you mean it works perfectly without the focusableInTouchMode="true"? Strange... Then just leave the focus there and hide the softkeyboard in your onCreate() or is there any other reason you don't to have it in focus except for the soft keyboard popping up? (Then set the focus to another view might be the easiest ).
Click to expand...
Click to collapse
I tried hiding the softkeyboard but for some reason it wont hide it just keeps popping up. And he main reason I do not want a focus is because I have a drawerlayout on the app and it contains 3 edit texts so everytime I open the drawer layout it invokes the keyboard to pop up and it selects the edit text which I do not want because its a feature where users may customize the value which they dont need to if they dont want too. As of setting focus to another view I believe I tried that but the edit text still receives the focus for some reason. Mind giving me an example of setting focus on something else? So i can make sure I am doing it right. Maybe a Linear or Relative Layout .
I just tried to hide the keyboard and just realized I am already hiding the keyboard but I am only hiding the default keyboard not the custom keyboard. So my question for you would be how would I hide the Custom Keyboard from showing oncreate?(tried this but no luck customKeyboard.hideCustomKeyboard(); ) it still shows but it does work because i tried it with an onlclick just not working on start. Not sure if you need to edit the customkeyboard java file. If you want I can post the test code im working with right now if you dont mind looking at it.
Hi,
I'm a french Android rookie, so excuse my english and my perhaps naive questions...
I am developing an app for Android (minSdk 14).
My main activity is a Processing PApplet, which has to be fullscreen, without an action bar.
From this activity, I want to launch a view to pass variables to my applet. I use onCreateOptionsMenu to open the options menu.
When I press the only item on this menu, I launch a "activity_settings"activity.
So far so good, but it bothers me that the user has to press the Options button, then the "Settings" button in the options menu.
So I tried to directly launch my "activity_settings" activity in onCreateOptionsMenu, without inflating the options menu.
It works the first time, but then "activity_settings" doesnt want to open any more ...
If I do the same thing using onPrepareOptionsMenu instead of onCreateOptionsMenu, it works and works again without problems ...
I do not understand why! If any nice coder wants to explain to me ... that would be nice!
Another issue, I cannot capture the size of an OnTouch event .
Code:
@Override
public boolean onTouchEvent(MotionEvent event) {
Log.d("Touched", String.valueOf(event.getSize()));
return super.onTouchEvent(event);
}
LogCat always shows "Touched" 0.0
Is it because of my device? Samsung GT7560 (Galaxy Trend)
Thank you in advance!
marzinp said:
Hi,
I'm a french Android rookie, so excuse my english and my perhaps naive questions...
I am developing an app for Android (minSdk 14).
My main activity is a Processing PApplet, which has to be fullscreen, without an action bar.
From this activity, I want to launch a view to pass variables to my applet. I use onCreateOptionsMenu to open the options menu.
When I press the only item on this menu, I launch a "activity_settings"activity.
So far so good, but it bothers me that the user has to press the Options button, then the "Settings" button in the options menu.
So I tried to directly launch my "activity_settings" activity in onCreateOptionsMenu, without inflating the options menu.
It works the first time, but then "activity_settings" doesnt want to open any more ...
If I do the same thing using onPrepareOptionsMenu instead of onCreateOptionsMenu, it works and works again without problems ...
I do not understand why! If any nice coder wants to explain to me ... that would be nice!
Another issue, I cannot capture the size of an OnTouch event .
Code:
@Override
public boolean onTouchEvent(MotionEvent event) {
Log.d("Touched", String.valueOf(event.getSize()));
return super.onTouchEvent(event);
}
LogCat always shows "Touched" 0.0
Is it because of my device? Samsung GT7560 (Galaxy Trend)
Thank you in advance!
Click to expand...
Click to collapse
Regarding the onCreateOptionsMenu, It works the first time only because this method is called only once when the activity is created, and the options menu is created.
The onPrepareOptionsMenu is called every time it the menu is shown, like every time you go back to the activity (The activity is resumed not created).
alphascript said:
Regarding the onCreateOptionsMenu, It works the first time only because this method is called only once when the activity is created, and the options menu is created.
The onPrepareOptionsMenu is called every time it the menu is shown, like every time you go back to the activity (The activity is resumed not created).
Click to expand...
Click to collapse
Thanks a lot, I didn't figure that! Ishould have!
For the second part of my question, it's definitely my device that isnt able to mesure pressure nor size of the touch.
Showing pointers from the dev options gave me the answer. Now I have to figure another way of capturing the touch size...
marzinp said:
Thanks a lot, I didn't figure that! Ishould have!
For the second part of my question, it's definitely my device that isnt able to mesure pressure nor size of the touch.
Showing pointers from the dev options gave me the answer. Now I have to figure another way of capturing the touch size...
Click to expand...
Click to collapse
See:
https://groups.google.com/forum/#!topic/android-developers/10pF8EUEuy0