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();
31 Aralık 2016 Cumartesi
22 Aralık 2016 Perşembe
To get Certificate fingerprint(MD5) (Parmak izi sertifikası nasıl alınır) for android
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))
10 Mayıs 2016 Salı
parent.getChildAt(positon) returns null visible child çözüldü
listview.getChildAt(positon) returns null hatasının çözümü
Aşağıdaki kodu listivew içinde yazın
View view;
int firstPos = listview.getFirstVisiblePosition();
int wantedPos = position - firstPos;
if ((wantedPos >= 0) && (wantedPos <= listview.getChildCount())
{
view =listview.getChildAt(wantedPos);
if (view == null){
return;}
else{
// burada view ' ı kullanın }
}
Aşağıdaki kodu listivew içinde yazın
View view;
int firstPos = listview.getFirstVisiblePosition();
int wantedPos = position - firstPos;
if ((wantedPos >= 0) && (wantedPos <= listview.getChildCount())
{
view =listview.getChildAt(wantedPos);
if (view == null){
return;}
else{
// burada view ' ı kullanın }
}
6 Mayıs 2016 Cuma
ConcurrentModificationException for ArrayList
ConcurrentModificationException for ArrayList Error
Böyle bir for döngüsü kullanıyorsanız
for (iterable_type iterable_element : iterable)
{
}
Yerine
for (int i = 0; i < array.length; i++) {
}
bu for döngüsünü kullanın sorun ortdan kalkacaktır
ConcurrentModificationException occurs when using iterators
Böyle bir for döngüsü kullanıyorsanız
for (iterable_type iterable_element : iterable)
{
}
Yerine
for (int i = 0; i < array.length; i++) {
}
bu for döngüsünü kullanın sorun ortdan kalkacaktır
ConcurrentModificationException occurs when using iterators
30 Nisan 2016 Cumartesi
Unmarshalling unknown type code error(Parcel)
How to fix Unmarshalling unknown type code xxx at ofset
RuntimeException -Unmarshalling unknown type
Bunun nedeni çok saçma ama read ve write sıralanması aynı olmamasından kaynaklanan bir hata örnek aşagıdaki gibi;
This can be caused by data being read in a different order than it's
been written. For example:
been written. For example:
WRONG
parcel.writeInt(...)
parcel.writeString()
parcel.writeString()
...
parcel.readString()
parcel.readInt()
parcel.readInt()
CORRECT
parcel.writeString(...)
parcel.writeInt()
parcel.writeInt()
...
parcel.readString()
parcel.readInt()
parcel.readInt()
Kaydol:
Kayıtlar (Atom)