Closed khushboosoni closed 10 years ago
I can't view your image since it's not public. Anw, CountryPicker is only a fragment that's embedded inside the parent LinearLayout, you can try adding a background color to edt_ctry and debug the layout
I have attached the screenshot with this email. I can only use log messages to debug my application as the debugger isn't working properly. If you can point out where to make changes, that will be really helpful.
Thanks, Khushboo
On Fri, Dec 6, 2013 at 3:29 PM, Thomas Dao notifications@github.com wrote:
I can't view your image since it's not public. Anw, CountryPicker is only a fragment that's embedded inside the parent LinearLayout, you can try adding a background color to edt_ctry and debug the layout
— Reply to this email directly or view it on GitHubhttps://github.com/roomorama/AndroidCountryPicker/issues/5#issuecomment-29968978 .
Sorry I won't support bug fix that's not specific to CountryPicker. It's best to ask on StackOverflow
@thomasdao Hello Thomas, is it possible to use CountryPicker within a dialogfragment? I want to open it as a dialog when an EditText element is touched/clicked. I am a beginner in programming and need some advice. I am not sure how to do this task. If you can guide me in any way, it will be really helpful. Thanks.
You can show CountryPicker as dialog:
private void showCountryPicker() {
CountryPicker picker = CountryPicker.newInstance("Select Country");
picker.setListener(new CountryPickerListener() {
@Override
public void onSelectCountry(String name, String code) {
Toast.makeText(
MainActivity.this,
"Country Name: " + name + " - Code: " + code
+ " - Currency: "
+ CountryPicker.getCurrencyCode(code),
Toast.LENGTH_SHORT).show();
}
});
picker.show(getSupportFragmentManager(), "COUNTRY_PICKER");
}
If you want to invoke this method when click on your editText:
editText.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
showCountryPicker();
}
});
Btw my best advice to you is to slow down and spend some time go through the basic Android, it will save you plenty of time later.
Thanks for your advice. You are right, I need to know the basics before, but I have been asked to volunteer for a charity project which has timing constraints. I am trying to do as much as I can and there is no senior developer to help, that's why I have been relying on internet and few people. Thanks a lot for your help.
Hello,
I am trying to use CountryPicker in my project under a form where a user enters his/her address. Here is my code:
public class FromMessageActivity extends FragmentActivity {
Here is my layout file:
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_below="@id/edt_addr2" android:background="@drawable/border_email" android:layout_marginLeft="20dp" android:layout_marginRight="20dp" android:layout_marginTop="20dp" android:orientation="horizontal" >
I am unable to use the picker for selecting a country. This is how it looks:
https://dl-web.dropbox.com/get/Public/2013-12-06_10-45-59.png?w=AAC3pydTk68RUCWux6Kk5hmQYkvcxknIlKvHViYzkdU5YQ
Please guide me as I am a beginner to android programming.
Thanks, Khushboo