Serkan GÖKÇE
Serkan GÖKÇE
İzmir
09/11/2014 tarihinden beri üye
140 GY Puanı
36K GY Sırası
2 Rozet
1 Sertifika
2 Soru Sordu
3 Cevap Verdi
0 Blog Yazısı
0 Etiket Takibi

Hakkında

İş Tecrubesi

Kullanıcıya ait İş tecrübesi bilgisi bulunmamaktadır.

Eğitim Geçmişi

Kullanıcıya ait Eğitim geçmişi bilgisi bulunmamaktadır.

Sertifikalar & Başarılar

GY Sertifikaları (1)
Android 101 Sertifikası
Veriliş Tarihi: Şubat 2015
Diğer Sertifikaları (0)
Kullanıcıya ait sertifika bulunmamaktadır.
Test Sonuçları (0)

Kullanıcıya ait test sonucu bulunmamaktadır.

Dil Becerileri

Son Forum Aktiviteleri

5
Tümünü Gör

kodlamada nerde hata yapıyorum

Arkadaşlar kendi yazmış olduğum bu kodla sitemden veri çekiyorum AsyncTask içine yazdığımda program yazılım android tarafından kapanmaya zorlanıyor AsyncTask dışında onCreate içine yazdığımda çalışıyor bu sefer tabletde hata veriyor nasıl çözerim.

[code]

package com.sgs.lotocilginligi;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.json.JSONArray;
import org.json.JSONObject;

import android.app.Activity;
import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.os.Bundle;
import android.widget.ListView;
import android.widget.Toast;


public class LotoSonuclari extends Activity {
    public ProgressDialog dialog = new ProgressDialog(LotoSonuclari.this);
    public int[] imageId = {R.drawable.image1,
            R.drawable.image1, R.drawable.image2, R.drawable.image3, R.drawable.image4,
            R.drawable.image5, R.drawable.image6, R.drawable.image7, R.drawable.image8,
            R.drawable.image9, R.drawable.image10, R.drawable.image11, R.drawable.image12,
            R.drawable.image13, R.drawable.image14, R.drawable.image15, R.drawable.image16,
            R.drawable.image17, R.drawable.image18, R.drawable.image19, R.drawable.image20,
            R.drawable.image21, R.drawable.image22, R.drawable.image23, R.drawable.image24,
            R.drawable.image25, R.drawable.image26, R.drawable.image27, R.drawable.image28,
            R.drawable.image29, R.drawable.image30, R.drawable.image31, R.drawable.image32,
            R.drawable.image33, R.drawable.image34, R.drawable.image35, R.drawable.image36,
            R.drawable.image37, R.drawable.image38, R.drawable.image39, R.drawable.image40,
            R.drawable.image41, R.drawable.image42, R.drawable.image43, R.drawable.image44,
            R.drawable.image45, R.drawable.image46, R.drawable.image47, R.drawable.image48,
            R.drawable.image49, R.drawable.image50, R.drawable.image51, R.drawable.image52,
            R.drawable.image53, R.drawable.image54
    };
    
    
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.sonuclistele);

        new sonuclarial().execute("");

    }

    public class sonuclarial extends AsyncTask<String, String, String>{

        @Override
        protected void onPreExecute() {
            // TODO Auto-generated method stub
            super.onPreExecute();
            dialog.setMessage("Yükleniyor...");
            dialog.show();
        }

        @Override
        protected String doInBackground(String... params) {
            // TODO Auto-generated method stub

            HttpClient httpclient = new DefaultHttpClient();
            HttpGet httpget = new HttpGet(" burada kod çektiğim link var ");
            HttpResponse response;

            try {
                response = httpclient.execute(httpget);
                HttpEntity entity = response.getEntity();

                if (entity != null) {

                    try {
                        InputStream instream = entity.getContent();
                        String line = "";
                        BufferedReader reader = new BufferedReader(new InputStreamReader(instream));
                        StringBuilder json = new StringBuilder();

                        while ((line = reader.readLine()) != null) {
                            json.append(line + "\n");
                        }


                        JSONObject obj = new JSONObject(json.toString());
                        JSONArray Jsonuclar = obj.getJSONArray("sonuclar");


                        JSONObject s1 = Jsonuclar.getJSONObject(0);
                        JSONObject s2 = Jsonuclar.getJSONObject(1);
                        JSONObject s3 = Jsonuclar.getJSONObject(2);
                        JSONObject s4 = Jsonuclar.getJSONObject(3);

                        ListView lv;
                        lv = (ListView) findViewById(com.sgs.lotocilginligi.R.id.liste);

                        SatırBilgi sonucDizi[] = new SatırBilgi[]{
                                new SatırBilgi(1, imageId[s1.getInt("s1")], imageId[s1.getInt("s2")], imageId[s1.getInt("s3")], imageId[s1.getInt("s4")], imageId[s1.getInt("s5")], imageId[s1.getInt("s6")], "Tarih : " +  s1.getString("tarih"), "Hafta : " +  s1.getString("hafta"), "Model : " +  s1.getString("model")),
                                new SatırBilgi(2, imageId[s2.getInt("s1")], imageId[s2.getInt("s2")], imageId[s2.getInt("s3")], imageId[s2.getInt("s4")], imageId[s2.getInt("s5")], imageId[s2.getInt("s6")], "Tarih : " +  s2.getString("tarih"), "Hafta : " +  s2.getString("hafta"), "Model : " +  s2.getString("model")),
                                new SatırBilgi(3, imageId[s3.getInt("s1")], imageId[s3.getInt("s2")], imageId[s3.getInt("s3")], imageId[s3.getInt("s4")], imageId[s3.getInt("s5")], imageId[s3.getInt("s6")], "Tarih : " +  s3.getString("tarih"), "Hafta : " +  s3.getString("hafta"), "Model : " +  s3.getString("model")),
                                new SatırBilgi(4, imageId[s4.getInt("s1")], imageId[s4.getInt("s2")], imageId[s4.getInt("s3")], imageId[s4.getInt("s4")], imageId[s4.getInt("s5")], imageId[s4.getInt("s6")], "Tarih : " +  s4.getString("tarih"), "Hafta : " +  s4.getString("hafta"), "Model : " +  s4.getString("model"))
                        };

                        SatırAdaptor adap = new SatırAdaptor(LotoSonuclari.this, com.sgs.lotocilginligi.R.layout.list_satir, sonucDizi);
                        lv.setAdapter(adap);
                        instream.close();

                    } catch (Exception e) {
                        Toast.makeText(getApplicationContext()," Hata : "+ e, Toast.LENGTH_LONG).show();
                    }
                }

            } catch (Exception e) {
                Toast.makeText(getApplicationContext()," Hata : "+ e, Toast.LENGTH_LONG).show();
            }

            return null;
        }

        @Override
        protected void onPostExecute(String result) {
            // TODO Auto-generated method stub
            super.onPostExecute(result);

            dialog.dismiss();
        }

    }

}

 

[/code]

9 yıl 2 ay önce yanıtladın

android listview adapter

Eclipse de kendimce yapmaya çalıştığım küçük bir uygulamada takıldım JSon ile çekmiş olduğum 4 satır veriyi listview de tek satırda text olarak göstere biliyorum ancak adapter kullanarak özelleştirmeye gelince örnek olarak gelen verilerin ilk altı tanesi resim son 3 tanesi text bunu adaptere atarak 4 satırlık veriyi listview de nasıl göstereceğim resimler res/drawable içinde mevcut örnek olarak

res/drawable/image1.png - res/drawable/image2.png - res/drawable/image3.png - res/drawable/image4.png - res/drawable/image5.png - res/drawable/image6.png resimler JSon ile gelen veri örnek olarak 1,2,3,4,5,6,text,text,text bu veriyi adapter kullanarak listview de nasıl göstereceğim

9 yıl 5 ay önce yanıtladın

kodlamada nerde hata yapıyorum

24 Şubat 2015 tarihinde cevaplandı

kodlamada söylenen global tanımlamaları yaptım gerekli bilgileri adaptordan lv set yaptım. Ancak yine çalışmadı sorun gözden kaçan ProgressDialog daymış bunu AsyncTask içine public olarak tanımladım onPreExecute show yaptım onPostExecute dismiss ve sorun çözüldü.

herkese yardımları için teşekkürler.

kodlamada nerde hata yapıyorum

19 Şubat 2015 tarihinde cevaplandı

Yardımda bulunan GökhanT ile BurhanAras beylere çok teşekkür ederim ancak ben bu işi beceremedim ve android kod yazmakdan sıkıldım.... Vaz geçeceğim gibi projeden.

android listview adapter

10 Kasım 2014 tarihinde cevaplandı

301 eğitimde anlatına yapıyorum yapamadığım şey yan yana 6 resim 3 text içeren örnek
kisiler.add(new Kisi("Ahmet Yılmaz", false))  yerine
sonuclar.add(new Sonuc(1,2,3,4,5,6,"text1","text2","text3")) şeklinde yapmak satır layout içinde de gelen değer
1,2,3,4,5,6 yı
image1.png, image2.png, image3.png, image4.png, image5.png, image6.png ve text, text, text şeklinde yazmak nadense bir türlü beceremedim satır layotum
aşağıdaki gibi sonuc class ını ve OzelAdapter kodlamada sıkıntım var neyse kendim çıkamadım işin içinden sizlerinde zamanını almak istemiyorum allaha emanet olun yorumlarınız için teşekkürler...
 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal" >
 
    <ImageView
       android:id="@+id/img1"
       android:layout_width="32dp"
       android:layout_height="32dp" />

    <ImageView
       android:id="@+id/img2"
       android:layout_width="32dp"
       android:layout_height="32dp" />

    <ImageView
       android:id="@+id/img3"
       android:layout_width="32dp"
       android:layout_height="32dp" />

    <ImageView
       android:id="@+id/img4"
       android:layout_width="32dp"
       android:layout_height="32dp" />

    <ImageView
       android:id="@+id/img5"
       android:layout_width="32dp"
       android:layout_height="32dp" />

    <ImageView
       android:id="@+id/img6"
       android:layout_width="32dp"
       android:layout_height="32dp" />

 
    <TextView
       android:id="@+id/txt1"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content" />

    <TextView
       android:id="@+id/txt2"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content" />

    <TextView
       android:id="@+id/txt3"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content" />
 
</LinearLayout>