kashayfxbytes / android-zoom-view

Automatically exported from code.google.com/p/android-zoom-view
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

Crash on view inflating: missing constructor #2

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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 lorenzo....@gmail.com on 19 Feb 2013 at 9:14

GoogleCodeExporter commented 9 years ago
yes
it has already been reported early
xml support for zoomview will soon be available

Original comment by karooo...@gmail.com on 5 Mar 2013 at 1:21

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
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 karthika...@gmail.com on 13 Jun 2013 at 4:14

GoogleCodeExporter commented 9 years ago
hi i want to how to implement zoomview code in my project 
give details 
for remote desktop using smartphone 

Original comment by ghodake....@gmail.com on 21 Mar 2014 at 7:51