Shutting down VM on focus EditText?

87 views Asked by At

I was faced with a peculiar problem.
In my dialog I have an EditText, when I focused that, keyboard appears and type first word, but my app not responding for long time, until I closed that.
This is my function code for Showing Dialog:

 public void ShowDialog(String url){

    ViewGroup li = (ViewGroup) getLayoutInflater().inflate(R.layout.purchase_view, null);
    final TextView url_txt = (TextView) li.findViewById(R.id.url_txtView);

    url_txt.setText(url);


    purchase_dialog = new Dialog(this, R.style.Theme_Transparent);
    purchase_dialog.setContentView(li);


    purchase_dialog.show();
}

and my purchase_view.xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:gravity="center"
    android:visibility="gone"
    android:id="@+id/purchase_loadingbar">
    <ProgressBar
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>
</LinearLayout>
<RelativeLayout
    android:id="@+id/lay_comment"
    android:paddingBottom="15dp"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">
    <ImageView
        android:id="@+id/iconImgView"
        android:src="@drawable/ic_launcher"
        android:layout_alignParentRight="true"
        android:layout_alignBottom="@+id/h_scroll"
        android:layout_alignTop="@+id/h_scroll"
        android:background="#0096aa"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
    <HorizontalScrollView
        android:id="@+id/h_scroll"
        android:layout_toLeftOf="@+id/iconImgView"
        android:scrollingCache="false"
        android:animationCache="false"
        android:smoothScrollbar="true"
        android:overScrollMode="never"
        android:scrollbars="none"
        android:background="#0096aa"
        android:paddingTop="15dp"
        android:paddingRight="15dp"
        android:paddingLeft="12dp"
        android:paddingBottom="5dp"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">
        <TextView
            android:id="@+id/url_txtView"
            android:background="@android:color/white"
            android:text="@string/dialog_title"
            android:textStyle="bold"
            android:textSize="17sp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    </HorizontalScrollView>
    <LinearLayout
        android:id="@+id/linear"
        android:layout_below="@+id/h_scroll"
        android:descendantFocusability="beforeDescendants"
        android:focusableInTouchMode="true"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">
        <EditText
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />
    </LinearLayout>
    <WebView
        android:layout_below="@+id/linear"
        android:id="@+id/webView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
</RelativeLayout>

NOTE: web view loading a Url, that have several text input .

NOTE: I use from this code also before and after showing dialog, but my problem not solved:

purchase_dialog.getWindow().clearFlags(
                    WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
                            | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);

My Logcat error:

06-23 15:49:15.188  15042-15042/com.chistarayaneh.avvalmarket.app D/AndroidRuntime﹕ Shutting down VM
06-23 15:49:15.188  15042-15042/com.chistarayaneh.avvalmarket.app W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x2b542210)
06-23 15:49:15.278  15042-15244/com.chistarayaneh.avvalmarket.app W/HardwareRenderer﹕ Attempting to initialize hardware acceleration outside of the main thread, aborting



Thanks In Advance.

0

There are 0 answers