[Q] How to get/set android:keyboardMode value - Android Software Development

Hey,
Atm, I am trying to develop a new keyboard, but i have some problems with setting/getting android:keyboardMode value.
In my keyboard xml (qwerty.xml, like in Sample SoftKeyboard), i added the android:keyboardMode at some rows like this:
Code:
<Row android:rowEdgeFlags="bottom" android:keyboardMode="@id/mode_normal">
or
Code:
<Row android:rowEdgeFlags="bottom" android:keyboardMode="@id/mode_email">
Now my problem: How can i get the keyboardMode of the moment? How can i call the keyboardMode at runtime (display the row)?
Thanks for your help. Sorry for my english ... it's not very good

Related

[CHome aka Titanium Hack] Adding TalkURL Hotkey to Plugins

I just found out that if you add a TalkURL Registry String with a link to an app shortcut to any CHome Directory with ACTIONURL/SK2URL in it. It will launch the linked value when pressing the Green Send Button aka the "Call Button" instead of opening the Phone App.
Example:
Code:
HKLM:Software\Microsoft\CHome\TitaniumWeather\Page1
String
TalkURL = \Windows\Powerexe.exe
NOTE: CHome must be Refreshed after adding/editing this value.
EDIT: Added the Text file I made from extracting all the text out of the cmhome.dll. This is how I've been able to make buttons & found this hack. This text is the root to hacking CHome.
Donators to Date:
Code:
[COLOR="Blue"]generalmills $200 CAD[/COLOR]
great find! thank you again
grate pound
I can change the tools of my plugin now
Hi drkfngthdragnlrd, I think you are, very good for programming "Titanium" Plugins. We have many progs like SPB Weather or Traveller or whatever with a *.dll plugin for the today screen. Do you think it is possible, to create a Titianium Plugin there we can integrate such a *.dll plugin ?
NEO130 said:
Hi drkfngthdragnlrd, I think you are, very good for programming "Titanium" Plugins. We have many progs like SPB Weather or Traveller or whatever with a *.dll plugin for the today screen. Do you think it is possible, to create a Titianium Plugin there we can integrate such a *.dll plugin ?
Click to expand...
Click to collapse
It could be possible I guess. There is mention of SourceType="DLL" in the CHome DLL.
For example in Images;
Code:
<Image ID="ButtonUp" Width="195" Height="186" Opacity="0.0" ScalingAlgorithm="TriLinear" [COLOR="#0000ff"]SourceType="[COLOR="Red"]ImageSourceType[/COLOR]"[/COLOR] [COLOR="Blue"]Source="[COLOR="#ff0000"]ImageSource[/COLOR]"[/COLOR] />
SourceType = NONE/FILE/BUFFER/BITMAP/ICON/DLL
Source = location of the source. If it's a DLL, it should be followed by a comma and the DLL Resource # (You'd have to open the DLL in question to get the resource number).
NOTE: I believe BITMAP/ICON refers to EXE's/DLL's type BITMAPs/ICONs as some have that in a seperate directory inside the EXE/DLL.
Same goes for Text, but SourceType = InnerTextType & Source = Text
InnerTextType = Resource
Text = "Static Text" or "DLL,(Comma) Resource #)
EDIT/NOTE: The Custom Plugin GUID does not accept HARD CODED layouts in the cpr's with Source="what ever" in the line. It always wants to read a registry value. The only work around I found is if you are only using 1 page. Put the code outside of the <Layer ID="Page"></Layer> part of the expanded & condensed layouts.
Example;
Code:
[COLOR="Red"] <Layer ID="TitaniumWeatherCondensed" Visible="False" Width="45" Height="39">[/COLOR]
<!--Icon Image-->
[COLOR="Blue"] <Image ID="Icon" Left="2" Top="4" Width="31" Height="31" ScaleStyle="Stretch" Source="\Neo\Neo_Weather.png" />[/COLOR]
[COLOR="#ff0000"] <Layer ID="Page">
</Layer>
</Layer>[/COLOR]
??????????????? thanks, but this is the look like for me. What I or we need is a normal Titanium Plugin cab, in this we have a menu that we told them where the *.dll Plugin from the program is. I hope you understand my lazy wish.
This could be interesting for another purpose, drgn.. I should make a little investigation.
Another question - have you ever seen a possibility to change the angle or the opacity of an image by a registry value instead of hardcoded in a .plg?
Micha
MichelDiamond said:
This could be interesting for another purpose, drgn.. I should make a little investigation.
Another question - have you ever seen a possibility to change the angle or the opacity of an image by a registry value instead of hardcoded in a .plg?
Micha
Click to expand...
Click to collapse
I have not figured that out yet. If possible, I'll see if I can figure it out.
Cool - you know what it would mean, if that would be work - in combination with the buttons - I don't think that then anybody would use TouchFlo anymore...

[Q] GLSurfaceView and Soft Input

Hi,
I'm writing an open gl game and it requires the user to be able to type input for things such as high scores, saved games and whatnot.
The problem I'm having is that I can't get the soft input keyboard to display with the GLSurfaceView focused for input events.
Is there a trick to it? is it even possible? or do I have to draw my own keyboard with opengl?
I definitely do not want to show a separate activity with android controls because that would look really cheap and subtract from the game experience.
Any help would be appreciated,
Thank you.
Figured it out.
In the GLSurfaceView constructor I needed to set:
Code:
this.setFocusable(true);
this.setFocusableInTouchMode(true);
And then to show the keyboard:
Code:
((InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE)).showSoftInput(view, 0);
And to hide:
Code:
((InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(view.getWindowToken(), 0)
Not difficult, but it just isn't documented anywhere, at least not the setFocusable() stuff.

[Q] Convert Editable to String?

I am making a dialog box that the user can enter text into as input. I am using this sample code http://www.tutorials-android.com/learn/How_to_prompt_user_input_with_an_AlertDialog.rhtml
In that example it uses "String value = input.getText();" but the Eclipse says it doesn't work and makes me change 'value' to type 'Editable'. How do I convert it back into a string?
Thanks in advance
hyperbyteX said:
I am making a dialog box that the user can enter text into as input. I am using this sample code http://www.tutorials-android.com/learn/How_to_prompt_user_input_with_an_AlertDialog.rhtml
In that example it uses "String value = input.getText();" but the Eclipse says it doesn't work and makes me change 'value' to type 'Editable'. How do I convert it back into a string?
Thanks in advance
Click to expand...
Click to collapse
Try using "String value = input.getText().toString();"
thanks I got it!

[Q] Simple math, what am I missing?

Hi people!
I'm trying to learn how to develop android apps. I'm not trying to become a developer but for fun and learn this. So I go step by step.In the past I just have very basic visual basic and fortran experience...I don't know java lang. But while searching I found out that android is based on java. so I grabbed netbeans and jdk. and it was easy and understandable to do some basic math(with tutorials) with it, like + - * /
So I thought I'd give a try to appinventor. Ok easy enough.Done basic math. But I want to learn the code itself.
So I'm dealing with eclipse right know. I learned some basic stuff which you can not learn with appinventor.
But when it comes to basic math, I'm stuck!
Let me explain:
with appinventor it's easy to make this (pics are at the end of the post)
when I try to make this with eclicpe...I'm going nuts. I couldn't find any tutor.
Strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Lorem Ipsum</string>
<string name="input"></string>
<string name="butcel">Button</string>
<string name="result">result</string>
<string name="ClickHandler">ClickHandler</string>
</resources>
Click to expand...
Click to collapse
Forum does not let me enter my main.xml and main.java codes. so I atteched the pics and txt files below.
this gives me a "app has stopped unexpectedly" error
what I'm trying to do is
1)user inputs a number
2)clicks on a button (there will be several buttons in my app,this is just a test app)
3)application does some math with that number
ie. ((number*5)/2)
4)textView1 shows the result
Should it be simple like in appinventor or am I missing sth in my codes?
And I'm not sure but do I need to add a java math function or sth like that in my app to do simple math like this?
Any advice is appreciated.
Thanks in advance.
The first thing to check is your AndroidManifest.xml file. The Eclipse ADT plugin should create this file and include the main activity for your app automatically if it has been installed. However, an app will throw the error you are receiving if an activity is run that isn't listed in the manifest and it's very common(at least for me) to forget at first to add a newly created activity to the manifest. Below is an example of an AndroidManifest.xml file from the Hello, Android tutorial.
Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.helloandroid"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".HelloAndroid"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Hi there desisamay,
to be honest i did not really look and your code to try and find the error, but i did write you an example app you can expand or use to learn .
Attached to my post is the example app and my whole eclipse project directory of it.
The app has an edittext to input a number, a button to start the calculation x*2/5 and a textview to show the result.
I hope you enjoy it and if anything is still unclear, just ask!
when the activity starts you try to get the text of the edittext and convert it to string which is null since the edittext is empty at the beginning. You should get the input when you click the button (and maybe even check if the edittext is empty)
Dark3n said:
Hi there desisamay,
to be honest i did not really look and your code to try and find the error, but i did write you an example app you can expand or use to learn .
Attached to my post is the example app and my whole eclipse project directory of it.
The app has an edittext to input a number, a button to start the calculation x*2/5 and a textview to show the result.
I hope you enjoy it and if anything is still unclear, just ask!
Click to expand...
Click to collapse
Thank you very much! This was exactly what I was trying to do! I was trying to do this with onClickListener and defining values... But your lines are clear and understandable and now I know how to make definitions and basic math functions. I think there'd be more lines to write with onClickListener. But this way is simple and works like a charm. Thank you again.
Also I've added
android:inputType="numberDecimal|numberSigned"
Click to expand...
Click to collapse
to EditText in main.xml just to be sure the user inputs numbers only. maybe just "number" will do the same.
But one more question:
we write the result to output like this
output.setText("The result of " + mInput + " times two, divided by 5 is " + mOutput);
do we have to use some text in it? if I try just
output.setText(mOutput);
eclipse warns me
The method setText(CharSequence) in the type TextView is not applicable for the arguments (double)
Click to expand...
Click to collapse
and underlines setText with red. but we 've already defined mOutput before like double mOutput = (mInput*2/5);
@MongooseHelix
My AndroidManifest.xml was the same as you posted. Since I only have one action. Thanks.
@nemoc 23
I was trying to that. get the input when button clicked. Convert to string of course and do some math. But I couldn't.(now I can ) But you're right for checking the edittext field after clicking the button. I'm pretty sure if you click the button with an empty edittext area, app will give an error.(i tried and it did)
When writing my little app I'm planning to add this and warn the user with a toast text.
output.setText( mOutput.toString() );

start building app.. and immediately need your help

Hello.
I'm very new to app developing but for starting learning I'd like to modify an app I have, doing two things:
1) in this app I have an edit text (with the cursor blinking) and a custom keyboard (not the system one, but one just of that app) for writing on it (something like a lockscreen). The problem is that whenever I press the keyboard buttons, despide of seeing my touch on them, nothing appear in the edit text.
Here's the layout.xml
Code:
<com.android.internal.widget.PasswordEntryKeyboardView android:id="@id/keyboard" android:background="#00000000" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:keyBackground="@drawable/btn_keyboard_key_fulltrans" />
Is this right?
Where can I find why it's not writing? In the PasswordEntryKeyboardView.smali?
2) I'd like also to have the status bar visible but not expandable. I've found I should do it putting a overlay over status bar and consumed all input events. So I'd need a custom class which extends any layout and consumes touch event and then to consume touch event override the onInterceptTouchEvent method of the view group and return true.
This should be the code for that custom class (customViewGroup):
Code:
WindowManager manager = ((WindowManager) getApplicationContext()
.getSystemService(Context.WINDOW_SERVICE));
WindowManager.LayoutParams localLayoutParams = new WindowManager.LayoutParams();
localLayoutParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;
localLayoutParams.gravity = Gravity.TOP;
localLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE|
// this is to enable the notification to recieve touch events
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL |
// Draws over status bar
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
localLayoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
localLayoutParams.height = (int) (50 * getResources()
.getDisplayMetrics().scaledDensity);
localLayoutParams.format = PixelFormat.TRANSPARENT;
customViewGroup view = new customViewGroup(this);
manager.addView(view, localLayoutParams);
So, how to do it...
Do I have to add a new .smali in the widget folder with that code or can I add that code in a file there?
And how to override the onInterceptTouchEvent method of the view group and return true?
And how to remove it when I leave that app?
I hope someone helps me learning.
Thanks.

Categories

Resources