0

When an item in the ListActivity is clicked, and MyBrowser Activity is opened, the app gets unfortunatly stopped. I have checked in the LogCat it is showing a fatal error. Can't find the solution on this. Other activities works fine in the emulator but after clicking on browser, it is showing fatal exception.

LogCat

    ` --------- beginning of crash
    01-04 21:26:13.013    2487-2487/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
        Process: com.example.dell.firstapp, PID: 2487
        java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.dell.firstapp/com.example.dell.firstapp.MyBrowser}: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x12
                at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
                at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
                at android.app.ActivityThread.access$800(ActivityThread.java:151)
                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
                at android.os.Handler.dispatchMessage(Handler.java:102)
                at android.os.Looper.loop(Looper.java:135)
                at android.app.ActivityThread.main(ActivityThread.java:5257)
                at java.lang.reflect.Method.invoke(Native Method)
                at java.lang.reflect.Method.invoke(Method.java:372)
                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
         Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x12
                at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:572)
                at android.view.ViewGroup$MarginLayoutParams.<init>(ViewGroup.java:6660)
                at android.widget.LinearLayout$LayoutParams.<init>(LinearLayout.java:1864)
                at android.widget.LinearLayout.generateLayoutParams(LinearLayout.java:1776)
                at android.widget.LinearLayout.generateLayoutParams(LinearLayout.java:62)
                at android.view.LayoutInflater.rInflate(LayoutInflater.java:808)
                at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
                at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
                at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
                at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
                at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:378)
                at android.app.Activity.setContentView(Activity.java:2145)
                at com.example.dell.firstapp.MyBrowser.onCreate(MyBrowser.java:22)
                at android.app.Activity.performCreate(Activity.java:5990)
                at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
                at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
                at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
                at android.app.ActivityThread.access$800(ActivityThread.java:151)
                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
                at android.os.Handler.dispatchMessage(Handler.java:102)
                at android.os.Looper.loop(Looper.java:135)
                at android.app.ActivityThread.main(ActivityThread.java:5257)
                at java.lang.reflect.Method.invoke(Native Method)
                at java.lang.reflect.Method.invoke(Method.java:372)
                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

Layout file

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent" android:layout_height="match_parent">

    <LinearLayout
        android:weightSum="100"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">
        <EditText

            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:id="@+id/etURL"
            android:layout_weight="20" />
        <Button
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="Go"
            android:id="@+id/bGo"
            android:layout_weight="80"
            android:layout_marginRight="@+id/editText"/>
    </LinearLayout>
    <LinearLayout
        android:orientation="horizontal"
        android:weightSum="8"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">
        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/bBack"
            android:text="Go back page"
            android:layout_weight="2"/>
        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/bFwd"
            android:text="Go forward"
            android:layout_weight="2"
            />
        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/bRefresh"
            android:text="Refresh page"
            android:layout_weight="2"/>
        <Button android:text="clear History"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/bHistory"
            android:layout_weight="2"/>
    </LinearLayout>
    <WebView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:id="@+id/wvBrowser"></WebView>

</LinearLayout>

Android Manifest file

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.dell.firstapp" >
    <uses-sdk android:minSdkVersion="8"/>
    <uses-permission android:name="android.permission.SET_WALLPAPER"/>
    <uses-permission android:name="android.permission.INTERNET"/>

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >

        <activity
            android:name=".Splash"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity
            android:name=".Starting"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="com.example.dell.firstapp.STARTING" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity
            android:name=".Menu"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="com.example.dell.firstapp.MENU" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity
            android:name=".Email"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="com.example.dell.firstapp.EMAIL" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity
            android:name=".Camera" android:label="@string/app_name">
        </activity>
        <activity
            android:name=".MyBrowser" android:label="@string/app_name">
        </activity>
    </application>
</manifest>

Activity class

    public class MyBrowser extends Activity implements View.OnClickListener{

            EditText url;
            WebView ourBrow;
            @Override
            protected void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.simplebrowser);

                WebView ourBrow=(WebView) findViewById(R.id.wvBrowser);
                ourBrow.getSettings().setJavaScriptEnabled(true);
                ourBrow.getSettings().setLoadWithOverviewMode(true);
                ourBrow.getSettings().setUseWideViewPort(true);

                ourBrow.setWebViewClient(new ourViewClient());
                try {
                    ourBrow.loadUrl("http://www.google.com");
                }catch (Exception e){
                    e.printStackTrace();
                }

                Button go=(Button) findViewById(R.id.bGo);
                Button back=(Button) findViewById(R.id.bBack);
                Button forward=(Button) findViewById(R.id.bFwd);
                Button refresh=(Button) findViewById(R.id.bRefresh);
                Button clearHistory=(Button) findViewById(R.id.bHistory);
                url=(EditText) findViewById(R.id.etURL);
                go.setOnClickListener(this);
                back.setOnClickListener(this);
                forward.setOnClickListener(this);
                refresh.setOnClickListener(this);
                clearHistory.setOnClickListener(this);
            }

            @Override
            public void onClick(View v) {
                switch (v.getId()){
                    case R.id.bGo:
                        String theWebsite=url.getText().toString();
                        ourBrow.loadUrl(theWebsite);
                        //Hiding the keyboard after using an EditText
                        InputMethodManager imm=(InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
                        imm.hideSoftInputFromWindow(url.getWindowToken(),0);
                        break;
                    case R.id.bBack:
                        if(ourBrow.canGoBack())
                            ourBrow.goBack();
                        break;
                    case R.id.bFwd:
                        if(ourBrow.canGoForward())
                            ourBrow.goForward();
                        break;
                    case R.id.bRefresh:
                        ourBrow.reload();
                        break;
                    case R.id.bHistory:
                        ourBrow.clearHistory();
                        break;
                }
            }
        }

EDIT : new Exception

01-04 23:37:11.766    2227-2243/? E/eglCodecCommon﹕ **** ERROR unknown type 0x73000f (glSizeof,72)
01-04 23:37:11.864    2227-2243/? E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
01-04 23:37:12.000    2227-2243/? E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
01-04 23:37:16.058    2227-2243/? E/eglCodecCommon﹕ **** ERROR unknown type 0x73000f (glSizeof,72)
01-04 23:37:16.122    2227-2243/? E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
01-04 23:37:16.202    2227-2243/? E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
01-04 23:37:16.373    2227-2243/? E/eglCodecCommon﹕ **** ERROR unknown type 0x73000f (glSizeof,72)
01-04 23:37:16.471    2227-2243/? E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
01-04 23:37:16.585    2227-2243/? E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
01-04 23:37:19.396    2227-2243/? E/eglCodecCommon﹕ **** ERROR unknown type 0x73000f (glSizeof,72)
01-04 23:37:19.496    2227-2243/? E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
01-04 23:37:19.574    2227-2243/? E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
01-04 23:37:19.736    2227-2243/? E/eglCodecCommon﹕ **** ERROR unknown type 0x73000f (glSizeof,72)
01-04 23:37:19.802    2227-2243/? E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
01-04 23:37:19.916    2227-2243/? E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
01-04 23:37:20.366    2227-2243/? E/eglCodecCommon﹕ **** ERROR unknown type 0x73000f (glSizeof,72)
01-04 23:37:20.468    2227-2243/? E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
01-04 23:37:20.549    2227-2243/? E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
01-04 23:37:20.735    2227-2243/? E/eglCodecCommon﹕ **** ERROR unknown type 0x73000f (glSizeof,72)
01-04 23:37:20.798    2227-2243/? E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
01-04 23:37:20.879    2227-2243/? E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
01-04 23:37:21.065    2227-2243/? E/eglCodecCommon﹕ **** ERROR unknown type 0x73000f (glSizeof,72)
01-04 23:37:21.183    2227-2243/? E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
01-04 23:37:21.261    2227-2243/? E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
01-04 23:37:21.456    2227-2243/? E/eglCodecCommon﹕ **** ERROR unknown type 0x73000f (glSizeof,72)
01-04 23:37:21.572    2227-2243/? E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
01-04 23:37:21.685    2227-2243/? E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
01-04 23:37:21.872    2227-2243/? E/eglCodecCommon﹕ **** ERROR unknown type 0x73000f (glSizeof,72)
01-04 23:37:21.985    2227-2243/? E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
01-04 23:37:22.065    2227-2243/? E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
01-04 23:37:22.232    2227-2243/? E/eglCodecCommon﹕ **** ERROR unknown type 0x73000f (glSizeof,72)
01-04 23:37:22.337    2227-2243/? E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
01-04 23:37:22.422    2227-2243/? E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
01-04 23:37:23.628    2227-2243/? E/eglCodecCommon﹕ **** ERROR unknown type 0x73000f (glSizeof,72)
01-04 23:37:23.737    2227-2243/? E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
01-04 23:37:23.817    2227-2243/? E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
01-04 23:37:24.002    2227-2243/? E/eglCodecCommon﹕ **** ERROR unknown type 0x73000f (glSizeof,72)
01-04 23:37:24.053    2227-2243/? E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
01-04 23:37:24.136    2227-2243/? E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
01-04 23:37:24.337    2227-2243/? E/eglCodecCommon﹕ **** ERROR unknown type 0x73000f (glSizeof,72)
2Dee
  • 8,609
  • 7
  • 42
  • 53
ABSTONE
  • 3
  • 2

1 Answers1

0

Your error is

UnsupportedOperationException: Can't convert to dimension

It is caused by the below line (for your Go button) because Android cannot convert @+id/editText to a dimension :

android:layout_marginRight="@+id/editText"

android:layout_marginRight expects a dimension, either provided by a number or a dimension resource, see below examples

// number
android:layout_marginRight="16dp"

// dimension resource
android:layout_marginRight="@dimen/margin_size"
2Dee
  • 8,609
  • 7
  • 42
  • 53
  • Cool, glad you got it working ! Please [upvote(completely optionnal)/accept the answer](http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work) if it solved your problem, so the question can be marked as solved. Thanks in advance ;) – 2Dee Jan 04 '16 at 17:11
  • once i click on go button again app get stopped.... and also not working with other buttons – ABSTONE Jan 04 '16 at 17:30
  • What is the exception ? – 2Dee Jan 04 '16 at 17:31
  • 1
    This error is a different one from your first question, and is most likely an error linked to the emulator, see [this question](http://stackoverflow.com/questions/22348801/phonegap-eclipse-issue-eglcodeccommon-glutilsparamsize-unknow-param-errors). Please do not mix several issues in one stackoverflow question as it makes it hard for others to understand the initial problem and the related solution. If my answer solved your first problem, mark it as accepted, then create a different question with your next problem, and don't forget to first search on google for already available solutions ;) – 2Dee Jan 04 '16 at 18:16