Posts

Showing posts from June, 2013

Android Jellybean setError fix

Image
public class EditTextErrorJellyBean extends EditText {
    public EditTextErrorFixed(Context context) {
        super(context);
    }

    public EditTextErrorJellyBean(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public EditTextErrorJellyBean(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    @Override
    public boolean onKeyPreIme(int keyCode, KeyEvent event) {
        if (TextUtils.isEmpty(getText().toString())
                && keyCode == KeyEvent.KEYCODE_DEL)
            return true;
        else
            return super.onKeyPreIme(keyCode, event);
    }

    private Drawable lastErrorIcon = null;

    @Override
    protected void onFocusChanged(boolean focused, int direction,
            Rect previouslyFocusedRect) {
        super.onFocusChanged(focused, direction, previouslyFocusedRect);
        showErrorIconHax(lastErrorIcon);
    }

    @Override
    public void setError(CharSequence error, Drawable icon) {
 …

Regular Expression Meta Characters

Image
Regular Expression Description\d                                                Any digits    [0-9] .                                                  Match Any character except new line^                                                  Match the beginning of line\                                                  escape next meta character$                                                  Match the end of line |                                                    Alteration      ('0r' statement)()                                                  Grouping[]                                                  Custom character class\d                                                Any digits    [0-9]
\D                                                Any non digit      [^0-9]
\s                                                 Any white space character    [\t\n\x0B\f\r]
\S                                                Any non white space charater
\w                                        …

java.lang.IllegalArgumentException: Cannot draw recycled bitmaps

Image
06-10 00:36:34.374: E/AndroidRuntime(2394): java.lang.IllegalArgumentException: Cannot draw recycled bitmaps
06-10 00:36:34.374: E/AndroidRuntime(2394):     at android.view.GLES20Canvas.drawBitmap(GLES20Canvas.java:789)
06-10 00:36:34.374: E/AndroidRuntime(2394):     at android.view.GLES20RecordingCanvas.drawBitmap(GLES20RecordingCanvas.java:118)
06-10 00:36:34.374: E/AndroidRuntime(2394):     at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:393)
06-10 00:36:34.374: E/AndroidRuntime(2394):     at android.widget.ImageView.onDraw(ImageView.java:967)
06-10 00:36:34.374: E/AndroidRuntime(2394):     at com.pensio.papaya.views.PapayaCircularImageView.onDraw(PapayaCircularImageView.java:47)
06-10 00:36:34.374: E/AndroidRuntime(2394):     at android.view.View.draw(View.java:13707)
06-10 00:36:34.374: E/AndroidRuntime(2394):     at android.view.View.getDisplayList(View.java:12645)
06-10 00:36:34.374: E/AndroidRuntime(2394):     at android.view.View.getDisplayList(View.java…

Custom Dialog Android

Image
package com.mobengineers;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;

public class DashboardActivity extends Activity {
    private static final int DIALOG_CUSTOM_ANIMATION = 1;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }

    public void onButtonDownUpActivityClick(View view) {
        startActivity(new Intent(this, DownUpActivity.class));
    }

    public void onButtonDialogClick(View view) {
        showDialog(DIALOG_CUSTOM_ANIMATION);
    }

    @Override
    protected Dialog onCreateDialog(int id) {
        switch (id) {
        case DIALOG_CUSTOM_ANIMATION:
            CustomAlertDialog dial…

06-06 00:10:15.857: E/AndroidRuntime(2704): java.lang.RuntimeException: Unable to start activity

Image
06-06 00:10:15.857: E/AndroidRuntime(2704): FATAL EXCEPTION: main
06-06 00:10:15.857: E/AndroidRuntime(2704): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.goingkilo.textlayout/com.goingkilo.textlayout.app.FlowText}: java.lang.NullPointerException
06-06 00:10:15.857: E/AndroidRuntime(2704):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
06-06 00:10:15.857: E/AndroidRuntime(2704):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
06-06 00:10:15.857: E/AndroidRuntime(2704):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
06-06 00:10:15.857: E/AndroidRuntime(2704):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
06-06 00:10:15.857: E/AndroidRuntime(2704):     at android.os.Handler.dispatchMessage(Handler.java:99)
06-06 00:10:15.857: E/AndroidRuntime(2704):     at android.os.Looper.loop(Looper.java:137)
06-06 00:10:15.857: E/AndroidRuntime(2704):   …