Search Results

Search found 4 results on 1 pages for 'arkaha'.

Page 1/1 | 1 

  • Android Canvas.drawString display problem

    - by Arkaha
    Hello everyone! I encounter this problem when displaying text on SurfaceView, some chars can climb up on others, code is here: private static void fakeDraw(Canvas c) { Paint mPaint = new Paint(); int color = 0xff000000; mPaint.setColor(color); mPaint.setStrokeWidth(2); mPaint.setStyle(Style.FILL); mPaint.setAntiAlias(true); FontMetricsInt fm = mPaint.getFontMetricsInt(); int fh = Math.abs(fm.top); int left = 0; int top = 100; Rect smallClip = new Rect(left, top-fh, left + 200, top + 30); Rect bigClip = new Rect(0, 0, getW(), getH()); c.drawRect(bigClip, mPaint); String text1 = "Evi"; String text2 = ">>"; String text3 = "Tom"; color = 0xff303030; mPaint.setColor(color); c.drawRect(smallClip, mPaint); color = 0xffffffff; mPaint.setColor(color); c.drawText(text1, left, top, mPaint); Rect bounds = new Rect(); mPaint.getTextBounds(text1, 0, text1.length(), bounds); left += bounds.width(); c.drawText(text2, left, top, mPaint); left -= bounds.width(); top += 12; c.drawText(text3, left, top, mPaint); mPaint.getTextBounds(text3, 0, text3.length(), bounds); left += bounds.width(); c.drawText(text2, left, top, mPaint); } In the case of a second text Tom all displayed correctly, but the first text Evi not. The problem is that the chars draws in Evi draw space(last char "i")!! It is possible to see if you zoom the picture, what am I doing wrong and how to fix this? screen shot can be found here:

    Read the article

  • J2ME JAD file analog in Android

    - by Arkaha
    When my server gaves apk file to user, I need to put some values In this file, for j2me platform I use JAD file, and put my values there: MY_KEY: SomeKeyValue MY_KEY2: SomeKeyValue2 When j2me application starts on device, I can access this values through System.getProperty. How can I do the same on android platform?

    Read the article

  • Java How to call method of grand parents?

    - by Arkaha
    Let's assume I have 3 classes A, B and C, each one extending the previous one. How do I call the code in A.myMethod() from C.myMethod() if B also implements myMethod? class A { public void myMethod() { // some stuff for A } } class B extends A { public void myMethod() { // some stuff for B //and than calling A stuff super.myMethod(); } } class C extends B { public void myMethod() { // some stuff for C // i don't need stuff from b, but i need call stuff from A // something like: super.super.myMethod(); ?? how to call A.myMethod(); ?? } }

    Read the article

  • String.substring(index) has stoped my thread in debug mode.

    - by Arkaha
    Hello! I work with j2me polish 2.0.7, in eclipse 3.4.2, with wtk2.5.2_01. I create control which draws text: normal, bold, and italic. The code below is parsing raw text, and search for * and _ symbols, if found than add to draw vector the text and the drawer, and it's just stops after getting second time to the line 58: String test = new String(raw_text_buff.substring(iter)); it stops in raw_text_buff.substring(iter), ONLY in debug mode.. raw text is: bla bla bla *1000* bla bla Full code: private String raw_text = "bla bla bla *1000* bla bla"; Vector draw_items = null; private void prepareText() { char open_char = 0; int open_pos = 0; Object []param = null; StringBuffer sb = new StringBuffer(); String raw_text_buff = new String(raw_text); int iter = 0; boolean was_reset = false; while(true) { char c = raw_text_buff.charAt(iter); if(iter == raw_text_buff.length() || c == '*' || c == '_') { if(sb.length() > 0) { BmFont viewer = null; String str = sb.toString(); if(open_char == '*' && null != bm_strong) { viewer = bm_strong.getViewer(str); }else if(open_char == '_' && null != bm_italic) { viewer = bm_italic.getViewer(str); }else if(null != bm_normal) { viewer = bm_normal.getViewer(str); }else { } param = new Object[2]; param[0] = str; param[1] = viewer; if(null == draw_items) draw_items = new Vector(); draw_items.addElement(param); sb = new StringBuffer(); if(open_char == 0 && (c == '*' || c=='_')) open_char = c; else open_char = 0; String test = new String(raw_text_buff.substring(iter)); // stucks here. raw_text_buff = test; iter = 0; was_reset = true; }else { open_char = c; } if(iter == raw_text_buff.length()) break; }else { sb.append(c); } ++iter; } } What I'm doing wrong?

    Read the article

1