File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Android and the fly likes virtual key board source code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "virtual key board source code" Watch "virtual key board source code" New topic
Author

virtual key board source code

deepika deepi
Ranch Hand

Joined: Jan 23, 2012
Posts: 199
hi,

i want to create an virtual keyboard in android. can any one help me how to achieve that with the a font.?
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1478
    
    6

May be you could use a Dialog where you can add Buttons to show the keys, and this pops up when a key is pressed on EditText. You can pass the reference of EditText to this dialog class, and in button click event fetch the text of button and set it to edit text.


Swastik
deepika deepi
Ranch Hand

Joined: Jan 23, 2012
Posts: 199
can you illustrate with an example? for better understanding
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1478
    
    6

Deepika,

You can have a look on this. In this example I am using a numeric key pad, the only change what you need is to make a alphabetic/alphanumeric key pad.

main.xml
-----------


numericpopup.xml
---------------------




deepika deepi
Ranch Hand

Joined: Jan 23, 2012
Posts: 199
where to use this code?

public class NumbreKeyboardActivity extends Activity {
/** Called when the activity is first created. */
private EditText _etText;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
_etText=(EditText)this.findViewById(R.id.EditText01);
_etText.setOnTouchListener(new View.OnTouchListener(){

public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
if(event.getAction()==MotionEvent.ACTION_DOWN){
EditText et=(EditText)v;
et.setInputType(InputType.TYPE_CLASS_NUMBER);
NumericCalculator ncp=new NumericCalculator(NumbreKeyboardActivity.this,et);
ncp.show();
return true;
}
return false;
}

});
}
}
it will be stored in separate folder or this is continuation of the code?
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1478
    
    6

This is the main activity class. For your easier understanding I have pasted everything under different code tags.
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1478
    
    6

1. Create a project and name the Activity class name NumbreKeyboardActivity. Copy the code of the the class to this.
2. Add another class to the same project, i.e NumericCalculator, code is already there.
3. Moidfy the contents of main.xml
4. Add another xml file named numericpopup.xml, code is already given.
5. Build and run the project.
deepika deepi
Ranch Hand

Joined: Jan 23, 2012
Posts: 199
it contains public if i put in same code. so it shows some error. if i use the second code you have given to me. can you tell me the procedure along with this
deepika deepi
Ranch Hand

Joined: Jan 23, 2012
Posts: 199
thank you. the code is working fine
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1478
    
    6

You are welcome.
deepika deepi
Ranch Hand

Joined: Jan 23, 2012
Posts: 199
i need your help for few more changes. in this i have the tab in showing while i click the tab. is it possible to make it appear in upper or lower of this emulator?
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1478
    
    6

Do you mean, when the tab is tapped, the keyboard pops up? Can we have click events for tab, not very sure about this, probably a tab just represents an activity, correct me if I am wrong, however positioning the dialog looks possible.
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1478
    
    6

How to position the popup dialog
--------------------------------------
deepika deepi
Ranch Hand

Joined: Jan 23, 2012
Posts: 199
no i didn't talk about that. i wanted to see the virtual display before the display box. and according to the coding there exists some numerical data. i have created an addition program. and i want this coding to be used for giving the input. so that the coding is made some what useful so for this i need to call the addition file name in the NumericalKeyboardActivity coding ? is that enough ?
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1478
    
    6

Probably in your code you just need to include this part.
deepika deepi
Ranch Hand

Joined: Jan 23, 2012
Posts: 199
i have an addition program like this

package com.example.addition;


import android.app.Activity;

import android.os.Bundle;

import android.widget.EditText;

import android.widget.TextView;

import android.widget.Button;

import android.view.View;


public class AdditionActivity extends Activity
{
EditText amount1;
EditText amount2;
TextView tt;
Button calculate;
double x=0;
double y=0;
double z=0;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
initControls();
}
private void initControls()
{
amount1=(EditText)findViewById(R.id.amount1);
amount2=(EditText)findViewById(R.id.amount2);
tt=(TextView)findViewById(R.id.tt);
calculate=(Button)findViewById(R.id.calculate);
calculate.setOnClickListener(new Button.OnClickListener()
{public void onClick
(View v) { calculate();}});
}
private void calculate()
{
x=Double.parseDouble(amount1.getText().toString());
y=Double.parseDouble(amount2.getText().toString());
z=x+y;
tt.setText(Double.toString(z));
// System.out.println("you are inside calculate");
}
}

and i have tried to use the numeric keyboard for the addition program and changed the code like this

[code = android]
package com.example.addition;

import android.app.Activity;

import android.os.Bundle;

import android.widget.EditText;

import android.widget.TextView;

import android.widget.Button;

import android.text.InputType;
import android.view.MotionEvent;
import android.view.View;


public class AdditionActivity extends Activity
{
EditText amount1;
EditText amount2;
TextView tt;
Button calculate;
double x=0;
double y=0;
double z=0;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
initControls();
}
private void initControls()
{
amount1=(EditText)findViewById(R.id.amount1);
amount2=(EditText)findViewById(R.id.amount2);
EditText _etText = (EditText)this.findViewById(R.id.EditText01);
_etText.setOnTouchListener(new View.OnTouchListener(){

public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
if(event.getAction()==MotionEvent.ACTION_DOWN){
EditText et=(EditText)v;
et.setInputType(InputType.TYPE_CLASS_NUMBER);
NumericCalculator ncp=new NumericCalculator(AdditionActivity.this,et);

/*
//position where you wish to show
WindowManager.LayoutParams WMLP = ncp.getWindow().getAttributes();
WMLP.x = 100; //x position
WMLP.y = 100; //y position

ncp.getWindow().setAttributes(WMLP);
*/
ncp.show();
return true;
}
return false;
}

});
tt=(TextView)findViewById(R.id.tt);
calculate=(Button)findViewById(R.id.calculate);
calculate.setOnClickListener(new Button.OnClickListener()
{public void onClick
(View v) { calculate();}});
}
private void calculate()
{
x=Double.parseDouble(amount1.getText().toString());
y=Double.parseDouble(amount2.getText().toString());
z=x+y;
tt.setText(Double.toString(z));
// System.out.println("you are inside calculate");
}

}


[/code]
i am getting an output window but when i tried to enter the values and press the calculate key it shows

the application Addition(process com.example.addition) has stopped unexpectedly. Please Try again.



[Thumbnail for output problem for addition.jpg]

deepika deepi
Ranch Hand

Joined: Jan 23, 2012
Posts: 199
i have an addition program like this

package com.example.addition;


import android.app.Activity;

import android.os.Bundle;

import android.widget.EditText;

import android.widget.TextView;

import android.widget.Button;

import android.view.View;


public class AdditionActivity extends Activity
{
EditText amount1;
EditText amount2;
TextView tt;
Button calculate;
double x=0;
double y=0;
double z=0;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
initControls();
}
private void initControls()
{
amount1=(EditText)findViewById(R.id.amount1);
amount2=(EditText)findViewById(R.id.amount2);
tt=(TextView)findViewById(R.id.tt);
calculate=(Button)findViewById(R.id.calculate);
calculate.setOnClickListener(new Button.OnClickListener()
{public void onClick
(View v) { calculate();}});
}
private void calculate()
{
x=Double.parseDouble(amount1.getText().toString());
y=Double.parseDouble(amount2.getText().toString());
z=x+y;
tt.setText(Double.toString(z));
// System.out.println("you are inside calculate");
}
}


and i have tried to use the numeric keyboard for the addition program and changed the code like this


package com.example.addition;

import android.app.Activity;

import android.os.Bundle;

import android.widget.EditText;

import android.widget.TextView;

import android.widget.Button;

import android.text.InputType;
import android.view.MotionEvent;
import android.view.View;


public class AdditionActivity extends Activity
{
EditText amount1;
EditText amount2;
TextView tt;
Button calculate;
double x=0;
double y=0;
double z=0;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
initControls();
}
private void initControls()
{
amount1=(EditText)findViewById(R.id.amount1);
amount2=(EditText)findViewById(R.id.amount2);
EditText _etText = (EditText)this.findViewById(R.id.EditText01);
_etText.setOnTouchListener(new View.OnTouchListener(){

public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
if(event.getAction()==MotionEvent.ACTION_DOWN){
EditText et=(EditText)v;
et.setInputType(InputType.TYPE_CLASS_NUMBER);
NumericCalculator ncp=new NumericCalculator(AdditionActivity.this,et);

/*
//position where you wish to show
WindowManager.LayoutParams WMLP = ncp.getWindow().getAttributes();
WMLP.x = 100; //x position
WMLP.y = 100; //y position

ncp.getWindow().setAttributes(WMLP);
*/
ncp.show();
return true;
}
return false;
}

});
tt=(TextView)findViewById(R.id.tt);
calculate=(Button)findViewById(R.id.calculate);
calculate.setOnClickListener(new Button.OnClickListener()
{public void onClick
(View v) { calculate();}});
}
private void calculate()
{
x=Double.parseDouble(amount1.getText().toString());
y=Double.parseDouble(amount2.getText().toString());
z=x+y;
tt.setText(Double.toString(z));
// System.out.println("you are inside calculate");
}

}



i am getting an output window but when i tried to enter the values and press the calculate key it shows

the application Addition(process com.example.addition) has stopped unexpectedly. Please Try again.

can any body help here how to use the numeric key pad for addition program to calculate the values and get the result?
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1478
    
    6

Deepika,

Try this once

deepika deepi
Ranch Hand

Joined: Jan 23, 2012
Posts: 199
ya.. i have missed some thing to be changed. now i found that . this is a good work in deed. thank's a lot yar
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1478
    
    6

You are welcome.
deepika deepi
Ranch Hand

Joined: Jan 23, 2012
Posts: 199
hi,

here again in this numeric keyboard. i want to introduce some special characters like this. if i press the key 1 twice i want it to be replaced as "11" and thrice as "12" like that so on i want it to be displayed till i press 10 times " 19" and similarly for the number "2" i press twice and take the key out it should display the result as "22" ? i want to use like this characters so that i can use the like this for alphabets also as i wish and the virtual key board is not supporting all the characters on the display board. can any one help here?
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1478
    
    6

Deepika,

As these buttons are already having an event. May be you could add some other buttons on the numeric keyboard for your required functionality. Because you can't expect the same button to behave in two different ways.
deepika deepi
Ranch Hand

Joined: Jan 23, 2012
Posts: 199
i want to use an character mapping for tamil alphabet. if i press letter "A" it should be replaced by " அ" in tamil. there are no relevant stuffs to view an character map for this . so i am unable to proceed. can any one help me ?
Mayu Mayooresan
Ranch Hand

Joined: Mar 12, 2011
Posts: 37

deepika deepi wrote:i want to use an character mapping for tamil alphabet. if i press letter "A" it should be replaced by " அ" in tamil. there are no relevant stuffs to view an character map for this . so i am unable to proceed. can any one help me ?

Probably you need to use a class to convert "A" into "அ" everytime a keypress event occured. Check out this Android Project's Utill Class

If you want to enter system wide then you gotta develop a IME for Android. There are many Tamil Android IME's such as Tamil Visai which is open source.

deepika deepi
Ranch Hand

Joined: Jan 23, 2012
Posts: 199
hi,
i am not able to run that apk file. when it goes to the apk while running the command i am getting an error like this


[2012-05-23 18:11:59 - Tamilvisai] Failed to install Tamilvisai.apk on device 'emulator-5554!
[2012-05-23 18:11:59 - Tamilvisai] (null)
[2012-05-23 18:11:59 - Tamilvisai] Launch canceled!

can any one help me how to solve this error?
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1478
    
    6

You should get some error message related to this in the logcat.
deepika deepi
Ranch Hand

Joined: Jan 23, 2012
Posts: 199
hi,

i am getting an error like this

05-23 18:53:35.547: D/AndroidRuntime(353): Shutting down VM
05-23 18:53:35.616: W/dalvikvm(353): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
05-23 18:53:35.649: E/AndroidRuntime(353): FATAL EXCEPTION: main
05-23 18:53:35.649: E/AndroidRuntime(353): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mayuonline.tamildemo/com.mayuonline.tamildemo.TamilDemoActivity}: java.lang.RuntimeException: native typeface cannot be made
05-23 18:53:35.649: E/AndroidRuntime(353): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
05-23 18:53:35.649: E/AndroidRuntime(353): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-23 18:53:35.649: E/AndroidRuntime(353): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-23 18:53:35.649: E/AndroidRuntime(353): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-23 18:53:35.649: E/AndroidRuntime(353): at android.os.Handler.dispatchMessage(Handler.java:99)
05-23 18:53:35.649: E/AndroidRuntime(353): at android.os.Looper.loop(Looper.java:123)
05-23 18:53:35.649: E/AndroidRuntime(353): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-23 18:53:35.649: E/AndroidRuntime(353): at java.lang.reflect.Method.invokeNative(Native Method)
05-23 18:53:35.649: E/AndroidRuntime(353): at java.lang.reflect.Method.invoke(Method.java:521)
05-23 18:53:35.649: E/AndroidRuntime(353): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-23 18:53:35.649: E/AndroidRuntime(353): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-23 18:53:35.649: E/AndroidRuntime(353): at dalvik.system.NativeStart.main(Native Method)
05-23 18:53:35.649: E/AndroidRuntime(353): Caused by: java.lang.RuntimeException: native typeface cannot be made
05-23 18:53:35.649: E/AndroidRuntime(353): at android.graphics.Typeface.<init>(Typeface.java:147)
05-23 18:53:35.649: E/AndroidRuntime(353): at android.graphics.Typeface.createFromAsset(Typeface.java:121)
05-23 18:53:35.649: E/AndroidRuntime(353): at com.mayuonline.tamildemo.TamilDemoActivity.onCreate(TamilDemoActivity.java:16)
05-23 18:53:35.649: E/AndroidRuntime(353): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-23 18:53:35.649: E/AndroidRuntime(353): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
05-23 18:53:35.649: E/AndroidRuntime(353): ... 11 more
05-23 18:53:51.837: D/AndroidRuntime(360): Shutting down VM
05-23 18:53:51.887: W/dalvikvm(360): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
05-23 18:53:51.907: E/AndroidRuntime(360): FATAL EXCEPTION: main
05-23 18:53:51.907: E/AndroidRuntime(360): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mayuonline.tamildemo/com.mayuonline.tamildemo.TamilDemoActivity}: java.lang.RuntimeException: native typeface cannot be made
05-23 18:53:51.907: E/AndroidRuntime(360): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
05-23 18:53:51.907: E/AndroidRuntime(360): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-23 18:53:51.907: E/AndroidRuntime(360): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-23 18:53:51.907: E/AndroidRuntime(360): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-23 18:53:51.907: E/AndroidRuntime(360): at android.os.Handler.dispatchMessage(Handler.java:99)
05-23 18:53:51.907: E/AndroidRuntime(360): at android.os.Looper.loop(Looper.java:123)
05-23 18:53:51.907: E/AndroidRuntime(360): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-23 18:53:51.907: E/AndroidRuntime(360): at java.lang.reflect.Method.invokeNative(Native Method)
05-23 18:53:51.907: E/AndroidRuntime(360): at java.lang.reflect.Method.invoke(Method.java:521)
05-23 18:53:51.907: E/AndroidRuntime(360): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-23 18:53:51.907: E/AndroidRuntime(360): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-23 18:53:51.907: E/AndroidRuntime(360): at dalvik.system.NativeStart.main(Native Method)
05-23 18:53:51.907: E/AndroidRuntime(360): Caused by: java.lang.RuntimeException: native typeface cannot be made
05-23 18:53:51.907: E/AndroidRuntime(360): at android.graphics.Typeface.<init>(Typeface.java:147)
05-23 18:53:51.907: E/AndroidRuntime(360): at android.graphics.Typeface.createFromAsset(Typeface.java:121)
05-23 18:53:51.907: E/AndroidRuntime(360): at com.mayuonline.tamildemo.TamilDemoActivity.onCreate(TamilDemoActivity.java:16)
05-23 18:53:51.907: E/AndroidRuntime(360): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-23 18:53:51.907: E/AndroidRuntime(360): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
05-23 18:53:51.907: E/AndroidRuntime(360): ... 11 more
05-23 18:54:11.907: D/AndroidRuntime(367): Shutting down VM
05-23 18:54:11.936: W/dalvikvm(367): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
05-23 18:54:11.967: E/AndroidRuntime(367): FATAL EXCEPTION: main
05-23 18:54:11.967: E/AndroidRuntime(367): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mayuonline.tamildemo/com.mayuonline.tamildemo.TamilDemoActivity}: java.lang.RuntimeException: native typeface cannot be made
05-23 18:54:11.967: E/AndroidRuntime(367): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
05-23 18:54:11.967: E/AndroidRuntime(367): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-23 18:54:11.967: E/AndroidRuntime(367): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-23 18:54:11.967: E/AndroidRuntime(367): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-23 18:54:11.967: E/AndroidRuntime(367): at android.os.Handler.dispatchMessage(Handler.java:99)
05-23 18:54:11.967: E/AndroidRuntime(367): at android.os.Looper.loop(Looper.java:123)
05-23 18:54:11.967: E/AndroidRuntime(367): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-23 18:54:11.967: E/AndroidRuntime(367): at java.lang.reflect.Method.invokeNative(Native Method)
05-23 18:54:11.967: E/AndroidRuntime(367): at java.lang.reflect.Method.invoke(Method.java:521)
05-23 18:54:11.967: E/AndroidRuntime(367): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-23 18:54:11.967: E/AndroidRuntime(367): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-23 18:54:11.967: E/AndroidRuntime(367): at dalvik.system.NativeStart.main(Native Method)
05-23 18:54:11.967: E/AndroidRuntime(367): Caused by: java.lang.RuntimeException: native typeface cannot be made
05-23 18:54:11.967: E/AndroidRuntime(367): at android.graphics.Typeface.<init>(Typeface.java:147)
05-23 18:54:11.967: E/AndroidRuntime(367): at android.graphics.Typeface.createFromAsset(Typeface.java:121)
05-23 18:54:11.967: E/AndroidRuntime(367): at com.mayuonline.tamildemo.TamilDemoActivity.onCreate(TamilDemoActivity.java:16)
05-23 18:54:11.967: E/AndroidRuntime(367): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-23 18:54:11.967: E/AndroidRuntime(367): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
05-23 18:54:11.967: E/AndroidRuntime(367): ... 11 more

from the source code link what you have given . can you tell how to solve this ?
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1478
    
    6

Does the font file exist under assets/fonts? How are you creating the Typeface object to create the font?
Mayu Mayooresan
Ranch Hand

Joined: Mar 12, 2011
Posts: 37

Instead of running the APK you find in the bin folder, run the whole project by loading it in Eclipse. It should work. I worte that code and its working fine in my SAmsung Ace.
deepika deepi
Ranch Hand

Joined: Jan 23, 2012
Posts: 199
hi, i am not running the code from bin folder. i am running it from eclipse only with version 2.2 . but still i am getting this error .

05-23 18:53:35.547: D/AndroidRuntime(353): Shutting down VM
05-23 18:53:35.616: W/dalvikvm(353): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
05-23 18:53:35.649: E/AndroidRuntime(353): FATAL EXCEPTION: main
05-23 18:53:35.649: E/AndroidRuntime(353): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mayuonline.tamildemo/com.mayuonline.tamildemo.TamilDemoActivity}: java.lang.RuntimeException: native typeface cannot be made
05-23 18:53:35.649: E/AndroidRuntime(353): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
05-23 18:53:35.649: E/AndroidRuntime(353): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-23 18:53:35.649: E/AndroidRuntime(353): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-23 18:53:35.649: E/AndroidRuntime(353): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-23 18:53:35.649: E/AndroidRuntime(353): at android.os.Handler.dispatchMessage(Handler.java:99)
05-23 18:53:35.649: E/AndroidRuntime(353): at android.os.Looper.loop(Looper.java:123)
05-23 18:53:35.649: E/AndroidRuntime(353): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-23 18:53:35.649: E/AndroidRuntime(353): at java.lang.reflect.Method.invokeNative(Native Method)
05-23 18:53:35.649: E/AndroidRuntime(353): at java.lang.reflect.Method.invoke(Method.java:521)
05-23 18:53:35.649: E/AndroidRuntime(353): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-23 18:53:35.649: E/AndroidRuntime(353): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-23 18:53:35.649: E/AndroidRuntime(353): at dalvik.system.NativeStart.main(Native Method)
05-23 18:53:35.649: E/AndroidRuntime(353): Caused by: java.lang.RuntimeException: native typeface cannot be made
05-23 18:53:35.649: E/AndroidRuntime(353): at android.graphics.Typeface.<init>(Typeface.java:147)
05-23 18:53:35.649: E/AndroidRuntime(353): at android.graphics.Typeface.createFromAsset(Typeface.java:121)
05-23 18:53:35.649: E/AndroidRuntime(353): at com.mayuonline.tamildemo.TamilDemoActivity.onCreate(TamilDemoActivity.java:16)
05-23 18:53:35.649: E/AndroidRuntime(353): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-23 18:53:35.649: E/AndroidRuntime(353): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
05-23 18:53:35.649: E/AndroidRuntime(353): ... 11 more
05-23 18:53:51.837: D/AndroidRuntime(360): Shutting down VM
05-23 18:53:51.887: W/dalvikvm(360): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
05-23 18:53:51.907: E/AndroidRuntime(360): FATAL EXCEPTION: main
05-23 18:53:51.907: E/AndroidRuntime(360): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mayuonline.tamildemo/com.mayuonline.tamildemo.TamilDemoActivity}: java.lang.RuntimeException: native typeface cannot be made
05-23 18:53:51.907: E/AndroidRuntime(360): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
05-23 18:53:51.907: E/AndroidRuntime(360): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-23 18:53:51.907: E/AndroidRuntime(360): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-23 18:53:51.907: E/AndroidRuntime(360): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-23 18:53:51.907: E/AndroidRuntime(360): at android.os.Handler.dispatchMessage(Handler.java:99)
05-23 18:53:51.907: E/AndroidRuntime(360): at android.os.Looper.loop(Looper.java:123)
05-23 18:53:51.907: E/AndroidRuntime(360): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-23 18:53:51.907: E/AndroidRuntime(360): at java.lang.reflect.Method.invokeNative(Native Method)
05-23 18:53:51.907: E/AndroidRuntime(360): at java.lang.reflect.Method.invoke(Method.java:521)
05-23 18:53:51.907: E/AndroidRuntime(360): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-23 18:53:51.907: E/AndroidRuntime(360): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-23 18:53:51.907: E/AndroidRuntime(360): at dalvik.system.NativeStart.main(Native Method)
05-23 18:53:51.907: E/AndroidRuntime(360): Caused by: java.lang.RuntimeException: native typeface cannot be made
05-23 18:53:51.907: E/AndroidRuntime(360): at android.graphics.Typeface.<init>(Typeface.java:147)
05-23 18:53:51.907: E/AndroidRuntime(360): at android.graphics.Typeface.createFromAsset(Typeface.java:121)
05-23 18:53:51.907: E/AndroidRuntime(360): at com.mayuonline.tamildemo.TamilDemoActivity.onCreate(TamilDemoActivity.java:16)
05-23 18:53:51.907: E/AndroidRuntime(360): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-23 18:53:51.907: E/AndroidRuntime(360): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
05-23 18:53:51.907: E/AndroidRuntime(360): ... 11 more
05-23 18:54:11.907: D/AndroidRuntime(367): Shutting down VM
05-23 18:54:11.936: W/dalvikvm(367): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
05-23 18:54:11.967: E/AndroidRuntime(367): FATAL EXCEPTION: main
05-23 18:54:11.967: E/AndroidRuntime(367): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mayuonline.tamildemo/com.mayuonline.tamildemo.TamilDemoActivity}: java.lang.RuntimeException: native typeface cannot be made
05-23 18:54:11.967: E/AndroidRuntime(367): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
05-23 18:54:11.967: E/AndroidRuntime(367): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-23 18:54:11.967: E/AndroidRuntime(367): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-23 18:54:11.967: E/AndroidRuntime(367): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-23 18:54:11.967: E/AndroidRuntime(367): at android.os.Handler.dispatchMessage(Handler.java:99)
05-23 18:54:11.967: E/AndroidRuntime(367): at android.os.Looper.loop(Looper.java:123)
05-23 18:54:11.967: E/AndroidRuntime(367): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-23 18:54:11.967: E/AndroidRuntime(367): at java.lang.reflect.Method.invokeNative(Native Method)
05-23 18:54:11.967: E/AndroidRuntime(367): at java.lang.reflect.Method.invoke(Method.java:521)
05-23 18:54:11.967: E/AndroidRuntime(367): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-23 18:54:11.967: E/AndroidRuntime(367): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-23 18:54:11.967: E/AndroidRuntime(367): at dalvik.system.NativeStart.main(Native Method)
05-23 18:54:11.967: E/AndroidRuntime(367): Caused by: java.lang.RuntimeException: native typeface cannot be made
05-23 18:54:11.967: E/AndroidRuntime(367): at android.graphics.Typeface.<init>(Typeface.java:147)
05-23 18:54:11.967: E/AndroidRuntime(367): at android.graphics.Typeface.createFromAsset(Typeface.java:121)
05-23 18:54:11.967: E/AndroidRuntime(367): at com.mayuonline.tamildemo.TamilDemoActivity.onCreate(TamilDemoActivity.java:16)
05-23 18:54:11.967: E/AndroidRuntime(367): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-23 18:54:11.967: E/AndroidRuntime(367): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
05-23 18:54:11.967: E/AndroidRuntime(367): ... 11 more
05-24 10:46:05.140: D/AndroidRuntime(396): Shutting down VM
05-24 10:46:05.140: W/dalvikvm(396): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
05-24 10:46:05.197: E/AndroidRuntime(396): FATAL EXCEPTION: main
05-24 10:46:05.197: E/AndroidRuntime(396): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mayuonline.tamildemo/com.mayuonline.tamildemo.TamilDemoActivity}: java.lang.RuntimeException: native typeface cannot be made
05-24 10:46:05.197: E/AndroidRuntime(396): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
05-24 10:46:05.197: E/AndroidRuntime(396): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-24 10:46:05.197: E/AndroidRuntime(396): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-24 10:46:05.197: E/AndroidRuntime(396): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-24 10:46:05.197: E/AndroidRuntime(396): at android.os.Handler.dispatchMessage(Handler.java:99)
05-24 10:46:05.197: E/AndroidRuntime(396): at android.os.Looper.loop(Looper.java:123)
05-24 10:46:05.197: E/AndroidRuntime(396): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-24 10:46:05.197: E/AndroidRuntime(396): at java.lang.reflect.Method.invokeNative(Native Method)
05-24 10:46:05.197: E/AndroidRuntime(396): at java.lang.reflect.Method.invoke(Method.java:521)
05-24 10:46:05.197: E/AndroidRuntime(396): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-24 10:46:05.197: E/AndroidRuntime(396): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-24 10:46:05.197: E/AndroidRuntime(396): at dalvik.system.NativeStart.main(Native Method)
05-24 10:46:05.197: E/AndroidRuntime(396): Caused by: java.lang.RuntimeException: native typeface cannot be made
05-24 10:46:05.197: E/AndroidRuntime(396): at android.graphics.Typeface.<init>(Typeface.java:147)
05-24 10:46:05.197: E/AndroidRuntime(396): at android.graphics.Typeface.createFromAsset(Typeface.java:121)
05-24 10:46:05.197: E/AndroidRuntime(396): at com.mayuonline.tamildemo.TamilDemoActivity.onCreate(TamilDemoActivity.java:16)
05-24 10:46:05.197: E/AndroidRuntime(396): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-24 10:46:05.197: E/AndroidRuntime(396): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
05-24 10:46:05.197: E/AndroidRuntime(396): ... 11 more
05-24 10:46:20.867: D/AndroidRuntime(420): Shutting down VM
05-24 10:46:20.900: W/dalvikvm(420): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
05-24 10:46:20.947: E/AndroidRuntime(420): FATAL EXCEPTION: main
05-24 10:46:20.947: E/AndroidRuntime(420): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mayuonline.tamildemo/com.mayuonline.tamildemo.TamilDemoActivity}: java.lang.RuntimeException: native typeface cannot be made
05-24 10:46:20.947: E/AndroidRuntime(420): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
05-24 10:46:20.947: E/AndroidRuntime(420): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-24 10:46:20.947: E/AndroidRuntime(420): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-24 10:46:20.947: E/AndroidRuntime(420): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-24 10:46:20.947: E/AndroidRuntime(420): at android.os.Handler.dispatchMessage(Handler.java:99)
05-24 10:46:20.947: E/AndroidRuntime(420): at android.os.Looper.loop(Looper.java:123)
05-24 10:46:20.947: E/AndroidRuntime(420): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-24 10:46:20.947: E/AndroidRuntime(420): at java.lang.reflect.Method.invokeNative(Native Method)
05-24 10:46:20.947: E/AndroidRuntime(420): at java.lang.reflect.Method.invoke(Method.java:521)
05-24 10:46:20.947: E/AndroidRuntime(420): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-24 10:46:20.947: E/AndroidRuntime(420): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-24 10:46:20.947: E/AndroidRuntime(420): at dalvik.system.NativeStart.main(Native Method)
05-24 10:46:20.947: E/AndroidRuntime(420): Caused by: java.lang.RuntimeException: native typeface cannot be made
05-24 10:46:20.947: E/AndroidRuntime(420): at android.graphics.Typeface.<init>(Typeface.java:147)
05-24 10:46:20.947: E/AndroidRuntime(420): at android.graphics.Typeface.createFromAsset(Typeface.java:121)
05-24 10:46:20.947: E/AndroidRuntime(420): at com.mayuonline.tamildemo.TamilDemoActivity.onCreate(TamilDemoActivity.java:16)
05-24 10:46:20.947: E/AndroidRuntime(420): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-24 10:46:20.947: E/AndroidRuntime(420): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
05-24 10:46:20.947: E/AndroidRuntime(420): ... 11 more


how to solve this ?
deepika deepi
Ranch Hand

Joined: Jan 23, 2012
Posts: 199
hi i am getting an window .. i am trying to use the same code only but it does not support the output for android-tamilvisai



in the TamilSoftKeyboard.java this line an override was present when i am trying to use the code it showed error so i just removed the override that existing in the sentence


public void onSharedPreferenceChanged(SharedPreferences arg0, String arg1) {
// TODO Auto-generated method stub

}
}


the output screen shot i have attached. kindly help me i am using eclipse 2.2 for this type


[Thumbnail for tamil key board.png]

Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1478
    
    6

It's happening due to some uncaught exception. Use an exception handler block (try..catch) to see what exception you are getting.
deepika deepi
Ranch Hand

Joined: Jan 23, 2012
Posts: 199
i have used an try catch exception like this but there is no variations in the result

for tamildemo

package com.mayuonline.tamildemo;

import android.app.Activity;
import android.graphics.Typeface;
import android.os.Bundle;
import android.widget.TextView;

public class TamilDemoActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
try{
//initializing tf instance with Bamini font
Typeface tf = Typeface.createFromAsset(getAssets(),
"font/Bamini.ttf");

//Initializing TextView and setting the typeface created
TextView tamilTextView = (TextView)findViewById(R.id.textView1);
tamilTextView.setTypeface(tf);

//Tamil Unicode text goes here.
String tamilString = "வணக்கம் அன்ரொயிட்";

//creating intance of TamilFotnUtil Class
TamilFontUtil tfUtil = new TamilFontUtil();

//Convert Tamil font encording using the utility.
String tamilStringEncoded = tfUtil.convertTamilString(tamilString);

//Setting the text in the TextView
tamilTextView.setText(tamilStringEncoded);
}

catch(ArrayIndexOutOfBoundsException e){
//printed just to inform that we have entered the catch block
System.out.println("Oops, we went to far, better go back to 0!");
}

}
}



i am not getting any change
deepika deepi
Ranch Hand

Joined: Jan 23, 2012
Posts: 199
for tamilvisai also i tried to change with try catch exception . but i could not post that code here. if i post it is telling the abbreviation is needed .
eshaan mohd
Greenhorn

Joined: Feb 27, 2013
Posts: 1

hi sir,
would you please like to send source code of virtual keyboard(android platform) it wil be helpful for my project.
thank you sir
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: virtual key board source code