31 Aralık 2016 Cumartesi

getContentLength() returning -1

Android url connection getContentLength() returning negative value (-1) ?

SOLUTION
(ÇÖZÜM)

add this line 
(Bu satırı ekle)

urlConnection.setRequestProperty("Accept-Encoding","identiy");
.
.
.
as it's shown below
(aşağıda gösterildiği gibi)

HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setRequestProperty("Accept-Encoding","identiy"); // <--- Add this
int length = urlConnection.getContentLength();

22 Aralık 2016 Perşembe

To get Certificate fingerprint(MD5) (Parmak izi sertifikası nasıl alınır) for android



  • cd C:\Program Files\Java\jdk1.7.0_79 (note jdk version might be different in your pc )(Kodu yazın)
  • keytool -exportcert -alias androiddebugkey -keystore "C:\Users\userName\.android\debug.keystore" -list -v (Kodu yazın)
  • If it asks keystore password it's default  " android " type it ok (Şifre sorarsa "android" yazın )
  • Ok! you are done results are displayed for you (Tamamdır sonuçlar ekranda görüntülenecek)
  • how to run the key hash for facebook

    To get android key hash for facebook app (Facebook app için android key hash nasıl alınır) 


    • Download open ssl for windows here (dosyayı indirin)
    • Unzip it  to C drive as "openssl " file (Dosyayı "openssl" olarak C sürücüsüne çıkartın)
    • Open cmd prompt(Komut istemini açın)
    • Type cd C:\Program Files\Java\jdk1.7.0_79\bin (note jdk version might be different in your pc)(komutu yazın- jdk version sizde farklı olabilir ayrıca bakın)
    • And Finally type keytool -export -alias myAlias -keystore C:\Users\your user name\.android\myKeyStore | C:\openssl\bin\openssl sha1 -binary | C:\openssl\bin\openssl enc -a -e(Kodu yazın)
    • If it asks keystore password it's default  " android " type it ok (Şifre sorarsa "android" yazın )
    • You are done!  ( Bitti ! )

    12 Aralık 2016 Pazartesi

    android.content.res.Resources$NotFoundException:

    " FATAL EXCEPTION: main
                      android.content.res.Resources$NotFoundException: String resource ID #0x4
                          at android.content.res.Resources.getText
     "

    This exception occours Even when the resource is presents 

    It's most likely setting anything except string in text like here;
    (Büyük ihtimalle setText() ederken aldığı değer string değil örnek;)

     int i=10;
    mtextView.setText(i);

     it gets error above.It should be converted to string
    (Yukarıdaki hatalı.Değerin tipi stringe çevirilmelidir)

    SOLUTION:

     mtextView.setText(String.valueOf(i))