vikktorn / ExampleCountryPicker

Android Country, State/Region, City picker
9 stars 4 forks source link

Implement in Fragment #7

Closed VishalChauha closed 4 years ago

VishalChauha commented 4 years ago

i have tried to implement in Fragment but many errors like cannot resolve symbol getAssets() countryPicker = new CountryPicker.Builder().with(this).listener(this).build(); Cannot find this in bundle.with(this) Is it possible to implement it with fragment?

mohmmedHossam commented 4 years ago

Welcome Vikktorn/Examplecountrypicker

Can I see the code and solve it with you via TeamViewer?

On Wed, May 20, 2020, 12:39 PM Vishal Chauhan notifications@github.com wrote:

i have tried to implement in Fragment but many errors like cannot resolve symbol getAssets() countryPicker = new CountryPicker.Builder().with(this).listener(this).build(); Cannot find this in bundle.with(this) Is it possible to implement it with fragment?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/vikktorn/ExampleCountryPicker/issues/7, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOQFLIT3JWEWX5JSC56OX7DRSOXOJANCNFSM4NFZ756A .

vikktorn commented 4 years ago

I didn't use it for long time, but yes you can use it in fragment. Instead of this you must use getContect()

On Wed, May 20, 2020, 12:39 PM Vishal Chauhan notifications@github.com wrote:

i have tried to implement in Fragment but many errors like cannot resolve symbol getAssets() countryPicker = new CountryPicker.Builder().with(this).listener(this).build(); Cannot find this in bundle.with(this) Is it possible to implement it with fragment?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/vikktorn/ExampleCountryPicker/issues/7, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD3LL6RWPRQNFT47UTDJJETRSOXOJANCNFSM4NFZ756A .

Viktor Nesic

VishalChauha commented 4 years ago

Found solution i applied some changes 1). "getActivity()" replaced with "this" statePicker = new StatePicker.Builder().with(getActivity()).listener(this).build();

2). Removed @Override from public void onPointerCaptureChanged(boolean hasCapture) {

}

3). Add getActivity() before calling getAssets() InputStream inputStream = activity.getAssets().open("states.json");

Thanks for your great library. 👍

vikktorn commented 4 years ago

Thanks you for your support!!

Viktor Nesic

On Fri, May 22, 2020, 9:00 AM Vishal Chauhan notifications@github.com wrote:

Found solution i applied some changes 1). "getActivity()" replaced with "this" statePicker = new StatePicker.Builder().with(getActivity()).listener(this).build();

2). Removed @override https://github.com/override from public void onPointerCaptureChanged(boolean hasCapture) {

}

3). Add getActivity() before calling getAssets() InputStream inputStream = activity.getAssets().open("states.json");

Thanks for your great library. 👍

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/vikktorn/ExampleCountryPicker/issues/7#issuecomment-632526196, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD3LL6U4BQPN5H7FOZG3SETRSYPHVANCNFSM4NFZ756A .