26 Şubat 2013 Salı

Google Maps API Key

Nasıl alınır?

Aşağıda {path} olarak belirtilen alanda (bu C:\Users\your_username\.android oluyor) yani kullanıcı verilerinin içinde debug.keystore dosyasının bulunduğu adrestir.

keytool -list -v -alias androiddebugkey -keystore "{path}\debug.keystore" -storepass android -keypass android

Bunu komut satırında çalıştırdıktan sonra SHA1 karşısında bulunan anahtarı şimdilik bir kenara yazalım.

https://code.google.com/apis/console/  adresine giriş yaptıktan sonra Services (Servisler) sekmesinde
Google Maps API v2 servisine izin veriyoruz.

Ardından, API Access sekmesine geliyoruz.Burada mevcut değil ise bir adet Android Key almamız gerekmektedir. Create new Android Key butonuna basıp orada istediği boşluğa
yukarda ürettiğimiz anahtarı ve noktalı virgülle ayırıp proje paketini giriyoruz. Create butonuna basınca ekranda Key for Android apps (with certificates) kısmı altında API KEY karşısında yazan anahtarı uygulamamızda kullanabiliriz.
Örnek: A5:D4:C5;com.ornek.myproject

4 Mayıs 2012 Cuma

Dinamik Listener Metodu Eklemece

JSF ile Bean tarafından mevcut komponentleri dinamik oluşturma ve bunlara listener eklemek için kullanılan yol şu şekildedir.Dinamik üreteceğimiz komponent Combobox.

{
ExpressionFactory factory = FacesContext.getCurrentInstance().getApplication().getExpressionFactory();

HtmlSelectOneMenu myCombobox = new HtmlSelectOneMenu();
// Combobox liste değerleri
UISelectItems comboSelectItems = new UISelectItems();
comboSelectItems.setValue(ttsExternalGatewayComboList);
myCombobox.getChildren().add(new UISelectItem());
myCombobox.getChildren().add(comboSelectItems);
// Combobox rendered attribute değeri
myCombobox.setValueExpression("rendered", factory.createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{myBean.myRenderFlag ? true : false}", String.class));
// Combobox Ajax Ayarının Verilmesi
AjaxBehavior myComboboxAjax = new AjaxBehavior();
myComboboxAjax.setExecute(Arrays.asList(new String[]{ "@this" }));
myComboboxAjax.setRender(Arrays.asList(new String[] { "form:myPanelGrid" }));
myCombobox.addClientBehavior("change", myComboboxAjax);
// Combobox listener metodunun atanması
MethodExpression myComboboxMethodExpression= factory.createMethodExpression(FacesContext.getCurrentInstance().getELContext(),"#{myBean.comboboxValueChangeMethod}", null, new Class[]{ValueChangeEvent.class});
myCombobox.addValueChangeListener(new MethodExpressionValueChangeListener(myComboboxMethodExpression));
}