Coder Social home page Coder Social logo

Comments (9)

cesards avatar cesards commented on July 22, 2024

If we change:

((RoundedImageView) view.findViewById(R.id.imageView1)).setImageBitmap(item.mBitmap);
((RoundedImageView) view.findViewById(R.id.imageView1)).setScaleType(item.mScaleType);
((RoundedImageView)view.findViewById(R.id.imageView1)).setBorderColor(getResources().getColor(android.R.color.black));
((RoundedImageView) view.findViewById(R.id.imageView1)).setBorderWidth(position * 5);
((RoundedImageView) view.findViewById(R.id.imageView1)).setCornerRadius(position * 5);
            
            

by

((RoundedImageView)view.findViewById(R.id.imageView1)).setBorderColor(getResources().getColor(android.R.color.black));
((RoundedImageView) view.findViewById(R.id.imageView1)).setBorderWidth(position * 5);
((RoundedImageView) view.findViewById(R.id.imageView1)).setCornerRadius(position * 5);
((RoundedImageView) view.findViewById(R.id.imageView1)).setImageBitmap(item.mBitmap);
((RoundedImageView) view.findViewById(R.id.imageView1)).setScaleType(item.mScaleType);

note the difference in the last three images...

2013-03-05 17 29 41
2013-03-05 17 29 32

from roundedimageview.

cesards avatar cesards commented on July 22, 2024

if I use setRoundBackground before setting anything...

((RoundedImageView) view.findViewById(R.id.imageView1)).setRoundBackground(true);

I get:

03-05 17:31:28.307: E/AndroidRuntime(17302): FATAL EXCEPTION: main
03-05 17:31:28.307: E/AndroidRuntime(17302): java.lang.NullPointerException
03-05 17:31:28.307: E/AndroidRuntime(17302):    at com.makeramen.rounded.RoundedImageView.setBackgroundDrawable(RoundedImageView.java:151)
03-05 17:31:28.307: E/AndroidRuntime(17302):    at com.makeramen.rounded.RoundedImageView.setRoundBackground(RoundedImageView.java:222)
03-05 17:31:28.307: E/AndroidRuntime(17302):    at com.makeramen.rounded.example.RoundedActivity$StreamAdapter.getView(RoundedActivity.java:78)

from roundedimageview.

vinc3m1 avatar vinc3m1 commented on July 22, 2024

Fixed NPE in 0709c9e

from roundedimageview.

vinc3m1 avatar vinc3m1 commented on July 22, 2024

@M3N0R let me know if that fixes things

from roundedimageview.

cesards avatar cesards commented on July 22, 2024

Have you tested the demo? I think is giving null pointer exception all the time.

03-05 22:32:56.948: E/AndroidRuntime(15290): FATAL EXCEPTION: main
03-05 22:32:56.948: E/AndroidRuntime(15290): android.view.InflateException: Binary XML file line #8: Error inflating class com.makeramen.rounded.RoundedImageView
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.view.LayoutInflater.createView(LayoutInflater.java:613)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at com.makeramen.rounded.example.RoundedActivity$StreamAdapter.getView(RoundedActivity.java:69)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.widget.AbsListView.obtainView(AbsListView.java:2159)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.widget.ListView.makeAndAddView(ListView.java:1831)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.widget.ListView.fillDown(ListView.java:674)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.widget.ListView.fillFromTop(ListView.java:735)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.widget.ListView.layoutChildren(ListView.java:1638)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.widget.AbsListView.onLayout(AbsListView.java:1994)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.view.View.layout(View.java:14008)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.view.ViewGroup.layout(ViewGroup.java:4373)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.view.View.layout(View.java:14008)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.view.ViewGroup.layout(ViewGroup.java:4373)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1663)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1521)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.view.View.layout(View.java:14008)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.view.ViewGroup.layout(ViewGroup.java:4373)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.view.View.layout(View.java:14008)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.view.ViewGroup.layout(ViewGroup.java:4373)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1892)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1711)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:989)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4351)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.view.Choreographer.doCallbacks(Choreographer.java:562)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.view.Choreographer.doFrame(Choreographer.java:532)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.os.Handler.handleCallback(Handler.java:725)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.os.Handler.dispatchMessage(Handler.java:92)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.os.Looper.loop(Looper.java:137)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.app.ActivityThread.main(ActivityThread.java:5041)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at java.lang.reflect.Method.invokeNative(Native Method)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at java.lang.reflect.Method.invoke(Method.java:511)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at dalvik.system.NativeStart.main(Native Method)
03-05 22:32:56.948: E/AndroidRuntime(15290): Caused by: java.lang.reflect.InvocationTargetException
03-05 22:32:56.948: E/AndroidRuntime(15290):    at java.lang.reflect.Constructor.constructNative(Native Method)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.view.LayoutInflater.createView(LayoutInflater.java:587)
03-05 22:32:56.948: E/AndroidRuntime(15290):    ... 41 more
03-05 22:32:56.948: E/AndroidRuntime(15290): Caused by: java.lang.NullPointerException
03-05 22:32:56.948: E/AndroidRuntime(15290):    at com.makeramen.rounded.RoundedDrawable.setScaleType(RoundedDrawable.java:72)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at com.makeramen.rounded.RoundedImageView.setImageDrawable(RoundedImageView.java:148)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at android.widget.ImageView.(ImageView.java:122)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at com.makeramen.rounded.RoundedImageView.(RoundedImageView.java:46)
03-05 22:32:56.948: E/AndroidRuntime(15290):    at com.makeramen.rounded.RoundedImageView.(RoundedImageView.java:42)

from roundedimageview.

cesards avatar cesards commented on July 22, 2024

Also, I would like to know if it's necessary to set
setRoundBackground to true, because I think its unnecessary var.

I'm still playing with the lib, but the're are some stuff I don't understand at all... Maybe we could talk about some of your lib stuff, If you want to add me to gtalk we could talk without problems!!

[email protected]

:-)

It's always good having contacts in Mountain View ;-P

from roundedimageview.

vinc3m1 avatar vinc3m1 commented on July 22, 2024

setRoundBackgound make the setBackgroundDrawable also round. I needed it because I needed to have a default placeholder image and async fade in on top of it.

from roundedimageview.

SpiritMan avatar SpiritMan commented on July 22, 2024

Binary XML file line #7: Error inflating class com.makeramen.rounded.RoundedImageView

<com.makeramen.roundedimageview.RoundedImageView xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/cart_goods_logo"
    android:layout_width="32dp"
    android:layout_height="32dp"
    android:layout_centerVertical="true"
    android:layout_marginLeft="@dimen/margin_eight_dp"
    android:src="@drawable/logo"
    app:riv_corner_radius="@dimen/radius"
    app:riv_oval="false" />

<ImageView
    android:id="@+id/cart_label_icon"
    android:layout_width="24dp"
    android:layout_height="24dp"
    android:src="@drawable/atag_hot" />

from roundedimageview.

ruhanijeb avatar ruhanijeb commented on July 22, 2024

@vinc3m1

I am getting below error can you please help me its bit urgent.

UNHANDLED EXCEPTION:
[MonoDroid] Android.Views.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class com.makeramen.roundedimageview.RoundedImageView ---> Android.Views.InflateException: Binary XML file line #1: Error inflating class com.makeramen.roundedimageview.RoundedImageView ---> Java.Lang.Reflect.InvocationTargetException: Exception of type 'Java.Lang.Reflect.InvocationTargetException' was thrown. ---> Java.Lang.NoClassDefFoundError: Failed resolution of: Lcom/makeramen/roundedimageview/R$styleable; ---> Java.Lang.ClassNotFoundException: Didn't find class "com.makeramen.roundedimageview.R$styleable" on path: DexPathList[[zip file "/data/app/com.dharm.roundview-O3fRH_QINgCJR69fIVU_bw==/base.apk"],nativeLibraryDirectories=[/data/app/com.dharm.roundview-O3fRH_QINgCJR69fIVU_bw==/lib/x86, /system/fake-libs, /data/app/com.dharm.roundview-O3fRH_QINgCJR69fIVU_bw==/base.apk!/lib/x86, /system/lib, /vendor/lib]]
[MonoDroid] --- End of inner exception stack trace ---
[chatty] uid=10100(com.dharm.roundview) identical 2 lines
[MonoDroid] --- End of inner exception stack trace ---
[MonoDroid] at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00089] in <034d4a9852dd45bea9353cc7776c99f0>:0
[MonoDroid] at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0005d] in <034d4a9852dd45bea9353cc7776c99f0>:0
[MonoDroid] at Android.App.Activity.SetContentView (System.Int32 layoutResID) [0x00022] in :0
[MonoDroid] at roundview.MainActivity.OnCreate (Android.OS.Bundle savedInstanceState) [0x00009] in /Users/dharmender/Projects/roundview/roundview/MainActivity.cs:25
[MonoDroid] at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x00011] in :0
[MonoDroid] at (wrapper dynamic-method) System.Object.4(intptr,intptr,intptr)
[MonoDroid] --- End of managed Android.Views.InflateException stack trace ---
[MonoDroid] android.view.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class com.makeramen.roundedimageview.RoundedImageView
[MonoDroid] Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class com.makeramen.roundedimageview.RoundedImageView
[MonoDroid] Caused by: java.lang.reflect.InvocationTargetException
[MonoDroid] at java.lang.reflect.Constructor.newInstance0(Native Method)
[MonoDroid] at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
[MonoDroid] at android.view.LayoutInflater.createView(LayoutInflater.java:647)
[MonoDroid] at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
[MonoDroid] at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
[MonoDroid] at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
[MonoDroid] at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
[MonoDroid] at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
[MonoDroid] at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
[MonoDroid] at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
[MonoDroid] at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:419)
[MonoDroid] at android.app.Activity.setContentView(Activity.java:2669)
[MonoDroid] at md5c083c2735bea61cb3dc6e6f7c0287fc9.MainActivity.n_onCreate(Native Method)
[MonoDroid] at md5c083c2735bea61cb3dc6e6f7c0287fc9.MainActivity.onCreate(MainActivity.java:29)
[MonoDroid] at android.app.Activity.performCreate(Activity.java:7009)
[MonoDroid] at android.app.Activity.performCreate(Activity.java:7000)
[MonoDroid] at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
[MonoDroid] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
[MonoDroid] at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
[MonoDroid] at android.app.ActivityThread.-wrap11(Unknown Source:0)
[MonoDroid] at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
[MonoDroid] at android.os.Handler.dispatchMessage(Handler.java:106)
[MonoDroid] at android.os.Looper.loop(Looper.java:164)
[MonoDroid] at android.app.ActivityThread.main(ActivityThread.java:6494)
[MonoDroid] at java.lang.reflect.Method.invoke(Native Method)
[MonoDroid] at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
[MonoDroid] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
[MonoDroid] Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/makeramen/roundedimageview/R$styleable;
[MonoDroid] at com.makeramen.roundedimageview.RoundedImageView.(RoundedImageView.java:92)
[MonoDroid] at com.makeramen.roundedimageview.RoundedImageView.(RoundedImageView.java:86)
[MonoDroid] ... 27 more
[MonoDroid] Caused by: java.lang.ClassNotFoundException: Didn't find class "com.makeramen.roundedimageview.R$styleable" on path: DexPathList[[zip file "/data/app/com.dharm.roundview-O3fRH_QINgCJR69fIVU_bw==/base.apk"],nativeLibraryDirectories=[/data/app/com.dharm.roundview-O3fRH_QINgCJR69fIVU_bw==/lib/x86, /system/fake-libs, /data/app/com.dharm.roundview-O3fRH_QINgCJR69fIVU_bw==/base.apk!/lib/x86, /system/lib, /vendor/lib]]
[MonoDroid] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
[MonoDroid] at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
[MonoDroid] at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
[MonoDroid] ... 29 more

from roundedimageview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.