Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on view inflating: missing constructor #2

Open
GoogleCodeExporter opened this issue Mar 31, 2016 · 4 comments
Open

Crash on view inflating: missing constructor #2

GoogleCodeExporter opened this issue Mar 31, 2016 · 4 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Include the ZoomView in an existing layout, for example as a FrameLayout 
child.
2. Run the application.
3. Crash.

What is the expected output? What do you see instead?
I expect the ZoomView to be placed inside it's parent view. Exception thrown 
instead:

java.lang.RuntimeException: Unable to start activity ComponentInfo
 -> Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class pl.polidea.view.ZoomView
      -> Caused by: java.lang.NoSuchMethodException: <init> [class android.content.Context, interface android.util.AttributeSet]

The problem is that ZoomView does not provide alternative constructors that 
accept layout parameters. I fixed adding these two:

public ZoomView(Context context, AttributeSet attrs) { 
    this(context, attrs, 0);
}

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

Now it look to work well.

Original issue reported on code.google.com by [email protected] on 19 Feb 2013 at 9:14

@GoogleCodeExporter
Copy link
Author

yes
it has already been reported early
xml support for zoomview will soon be available

Original comment by [email protected] on 5 Mar 2013 at 1:21

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

i followed ur suggestion and got rid of inflation exception. but now i am 
getting null pointer exception at
View v1 = 
((LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.la
yout.standalone_example, null, false);
                v1.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));


                zoomview.addView(v1);//here


my xml code is as follows

 <LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/relat">
    <com.example.image.ZoomView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"

     >

    <com.example.image.PageCurlView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:id="@+id/dcgpagecurlPageCurlView1"
        >
    </com.example.image.PageCurlView>

</com.example.image.ZoomView>
</LinearLayout>

Original comment by [email protected] on 13 Jun 2013 at 4:14

@GoogleCodeExporter
Copy link
Author

hi i want to how to implement zoomview code in my project 
give details 
for remote desktop using smartphone 

Original comment by [email protected] on 21 Mar 2014 at 7:51

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant