-
Notifications
You must be signed in to change notification settings - Fork 6
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
Problem in xml preview #2
Comments
Thanks for your issue, I've noticed that too already, but didn't look into it. If you have some time, could you investigate why exactly this is happening? I suspect the application context required in line 57 to cause the problem. Maybe we could just display a "dummy" flag while in xml preview mode with |
I think the same thing, we need to use the |
After investigate I added this method in my
It's not the more elegant solution but it works. I can now scroll in the preview mode but the PhoneField layout isn't displayed. To go more deeper I think we can add |
Checking this fix with the sample app results in always getting another error: This class is imported in Would be great if you could clone the repository and try to preview the sample app's |
With the original version of the library or this fork, I have a problem during xml preview but not when I launch my app directly on a phone. It's annoying because if I put this customview in a scrollview I can't scroll in preview.
It's in this method
com.github.ialokim.phonefield.CountriesAdapter.getView
This is the stackStrace :
java.lang.NullPointerException at android.content.res.Resources_Delegate.getDrawable(Resources_Delegate.java:189) at android.content.res.Resources.getDrawable(Resources.java:827) at android.content.Context.getDrawable(Context.java:635) at androidx.core.content.ContextCompat.getDrawable(ContextCompat.java:463) at androidx.appcompat.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:203) at androidx.appcompat.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:191) at androidx.appcompat.content.res.AppCompatResources.getDrawable(AppCompatResources.java:102) at androidx.appcompat.widget.AppCompatImageHelper.setImageResource(AppCompatImageHelper.java:86) at androidx.appcompat.widget.AppCompatImageView.setImageResource(AppCompatImageView.java:94) at com.github.ialokim.phonefield.CountriesAdapter.getView(Unknown Source) at android.widget.AbsSpinner.onMeasure(AbsSpinner.java:204) at android.widget.Spinner.onMeasure(Spinner.java:602) at androidx.appcompat.widget.AppCompatSpinner.onMeasure_Original(AppCompatSpinner.java:421) at androidx.appcompat.widget.AppCompatSpinner.onMeasure(AppCompatSpinner.java) at android.view.View.measure_Original(View.java:23169) at android.view.View_Delegate.measure(View_Delegate.java:80) at android.view.View.measure(View.java:23133) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6749) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1535) at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:1187) at android.widget.LinearLayout.onMeasure(LinearLayout.java:706) at android.view.View.measure_Original(View.java:23169) at android.view.View_Delegate.measure(View_Delegate.java:80) at android.view.View.measure(View.java:23133) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6749) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1535) at android.widget.LinearLayout.measureVertical(LinearLayout.java:825) at android.widget.LinearLayout.onMeasure(LinearLayout.java:704) at android.view.View.measure_Original(View.java:23169) at android.view.View_Delegate.measure(View_Delegate.java:80) at android.view.View.measure(View.java:23133) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6749) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1535) at android.widget.LinearLayout.measureVertical(LinearLayout.java:825) at android.widget.LinearLayout.onMeasure(LinearLayout.java:704) at android.view.View.measure_Original(View.java:23169) at android.view.View_Delegate.measure(View_Delegate.java:80) at android.view.View.measure(View.java:23133) at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:1308) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at android.widget.ScrollView.onMeasure(ScrollView.java:350) at android.view.View.measure_Original(View.java:23169) at android.view.View_Delegate.measure(View_Delegate.java:80) at android.view.View.measure(View.java:23133) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6749) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at android.view.View.measure_Original(View.java:23169) at android.view.View_Delegate.measure(View_Delegate.java:80) at android.view.View.measure(View.java:23133) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461) at android.view.View.measure_Original(View.java:23169) at android.view.View_Delegate.measure(View_Delegate.java:80) at android.view.View.measure(View.java:23133) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6749) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at android.view.View.measure_Original(View.java:23169) at android.view.View_Delegate.measure(View_Delegate.java:80) at android.view.View.measure(View.java:23133) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461) at android.view.View.measure_Original(View.java:23169) at android.view.View_Delegate.measure(View_Delegate.java:80) at android.view.View.measure(View.java:23133) at com.android.layoutlib.bridge.impl.RenderSessionImpl.measureView(RenderSessionImpl.java:604) at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:343) at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:385) at com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:193) at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:509) at com.android.tools.idea.rendering.RenderTask.lambda$inflate$4(RenderTask.java:638) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)
The text was updated successfully, but these errors were encountered: