why this exception: java.lang.RuntimeException: Error inflating class

I am trying to develop a tiny android app that just opens a browser to a website. I am using mac OS 10.6 and the latest android/eclipse tools. But I keep getting this exception:

11-29 13:03:55.113: E/AndroidRuntime(1012): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mycomp/com.mycomp.pack}: android.view.InflateException: Binary XML file line #7: Error inflating class com.mycomp.MyTextView

Here is my code:

package com.mycomp;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

public class myapp extends Activity {
/** Called when the activity is first created. */`

private MyTextView myview;
public void onCreate(Bundle savedInstanceState) {
    Log.d("onCreate", "onCreate ");   

    myview  = (MyTextView)findViewById(R.id.myview);

public static   class MyTextView extends TextView {
    private View mLastVisChangedView;
    private int mLastChangedVisibility;
    private Activity parent;

    public void setParent(Activity p){
        parent =p;

    public MyTextView(Context context) {

    public MyTextView(Context context, AttributeSet attrs) {
        super(context, attrs);

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

    public View getLastVisChangedView() {
        return mLastVisChangedView;

    public int getLastChangedVisibility() {
        return mLastChangedVisibility;

    protected void  onVisibilityChanged(View changedView, int visibility){
        Log.d("onVisibilityChanged", "new vis == " + visibility);
        if (parent !=null && visibility == View.VISIBLE){
            parent.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.mysite.com")));


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" >




The type would be com.mycomp.myapp.MyTextView. (Or $ since it's an inner class?)

You may also need to specify the view as follows:

<view class="com.mycomp.myapp$MyEditText" ...

I don't think you need an onFinishInflate in this case.

Need Your Help

GCC 4.4.7 cannot convert from initializer list to std::array

c++ gcc c++11

I'm trying to put the top answer from this question into my own project, and am having trouble getting gcc to compile it (on RHEL linux using "-std=gnu++0x"). I have already made a few changes to t...

Automatically update the version of a product? - PHP

php version versioning

I created a product using php that I want to put on a website, but before I can do that I have to get it to update automatically. For example I have version 1.0 and there is a new version 1.2 it ha...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.