ahmet
ahmet
İstanbul-I (Avrupa)
17/09/2014 tarihinden beri üye
70 GY Puanı
50K GY Sırası

Kişisel Sayfaları

İlgi Alanları

1 Rozet
2 Sertifika
3 Soru Sordu
0 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

Akdeniz Üniversitesi
| Aralık 2020 - Aralık 2020

Sertifikalar & Başarılar

GY Sertifikaları (2)
Android 201 Sertifikası
Veriliş Tarihi: Şubat 2015
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

3
Tümünü Gör

CustomAdapter'de null pointer hatası (ArrayAdapter)


public class UserCustomAdapter extends ArrayAdapter<User> {
 
  UserHolder holder = null;
  Context context;
  int layoutResourceId;
  ArrayList<User> data = new ArrayList<User>();
  public UserCustomAdapter(Context context, int layoutResourceId,
    ArrayList<User> data) {
    super(context, layoutResourceId, data);
    this.layoutResourceId = layoutResourceId;
    this.context = context;
    this.data = data;
    }
    @Override
    public View getView(int position, final View convertView, ViewGroup parent) {
    
     View row = convertView;
    
    if (row == null) {
     LayoutInflater inflater = ((MainActivity) context).getLayoutInflater();
     row = inflater.inflate(layoutResourceId, parent, false);
     holder = new UserHolder();
     holder.textName = (TextView) row.findViewById(R.id.textView1);
     holder.textAddress = (TextView) row.findViewById(R.id.textView2);
     holder.textLocation = (TextView) row.findViewById(R.id.textView3);
     holder.btnEdit = (Button) row.findViewById(R.id.button1);
     holder.btnDelete = (Button) row.findViewById(R.id.button2);
     holder.imageView = (ImageView) row.findViewById(R.id.imageview1);
     holder.textViewDeneme = (TextView)row.findViewById(R.id.textView1s);
     
     row.setTag(holder);
     }
    else {
     holder = (UserHolder) row.getTag();
    
     }
    
     final User user = data.get(position);
     
     holder.textName.setText(user.getName());
     holder.textAddress.setText(user.getAddress());
     holder.textLocation.setText(user.getLocation());
     holder.imageView.setImageResource(user.iconid());
  
     
     holder.btnEdit.setOnClickListener(new OnClickListener() {
    
      @Override
      public void onClick(View v) {
      // TODO Auto-generated method stub
       
       
      Log.i("Edit Button Clicked", "**********");
      Toast.makeText(context, user.getAddress().toString(),  Burası  Çalışıyor
      Toast.LENGTH_LONG).show();
      
      //String adres = user.getAddress().toString();             
      
      //holder.textViewDeneme.setText(adres);                     Null Pointer Hatası veriyor
      
      
      }
      });
      holder.btnDelete.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
      // TODO Auto-generated method stub
      Log.i("Delete Button Clicked", "**********");
      Toast.makeText(context, "Delete button Clicked",
      Toast.LENGTH_LONG).show();
      }
      });
    
        holder.imageView.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
        // TODO Auto-generated method stub
        Log.i("image Clicked", "**********");
        Toast.makeText(context, "image Clicked",
        Toast.LENGTH_LONG).show();
        }
        });
        
     return row;
        }
   
  
  
static class UserHolder {
      TextView textName;
      TextView textAddress;
      TextView textLocation;
      Button btnEdit;
      Button btnDelete;
      ImageView imageView;
      TextView textViewDeneme;
    }
    
    }

 

 


03-27 14:42:25.440: W/dalvikvm(6890): threadid=1: thread exiting with uncaught exception (group=0x41db8c08)
03-27 14:42:25.440: E/AndroidRuntime(6890): FATAL EXCEPTION: main
03-27 14:42:25.440: E/AndroidRuntime(6890): Process: com.example.customlistviweheman, PID: 6890
03-27 14:42:25.440: E/AndroidRuntime(6890): java.lang.NullPointerException
03-27 14:42:25.440: E/AndroidRuntime(6890):  at com.example.customlistviweheman.UserCustomAdapter$1.onClick(UserCustomAdapter.java:69)
03-27 14:42:25.440: E/AndroidRuntime(6890):  at android.view.View.performClick(View.java:4633)
03-27 14:42:25.440: E/AndroidRuntime(6890):  at android.view.View$PerformClick.run(View.java:19330)
03-27 14:42:25.440: E/AndroidRuntime(6890):  at android.os.Handler.handleCallback(Handler.java:733)
03-27 14:42:25.440: E/AndroidRuntime(6890):  at android.os.Handler.dispatchMessage(Handler.java:95)
03-27 14:42:25.440: E/AndroidRuntime(6890):  at android.os.Looper.loop(Looper.java:157)
03-27 14:42:25.440: E/AndroidRuntime(6890):  at android.app.ActivityThread.main(ActivityThread.java:5356)
03-27 14:42:25.440: E/AndroidRuntime(6890):  at java.lang.reflect.Method.invokeNative(Native Method)
03-27 14:42:25.440: E/AndroidRuntime(6890):  at java.lang.reflect.Method.invoke(Method.java:515)
03-27 14:42:25.440: E/AndroidRuntime(6890):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
03-27 14:42:25.440: E/AndroidRuntime(6890):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
03-27 14:42:25.440: E/AndroidRuntime(6890):  at dalvik.system.NativeStart.main(Native Method)

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

Android unfortunately has stopped hatası

Konum bilğimi alırken sürekli uygulama daha açılmadan bu hatayı alıyorum. LocationManeger kullanarak konum bilgimi alabildigimi fakat ConnectionCallbacks ve OnConnectionFailedListener'i implement ederek denedigimde bu hatayı aldığımı farkettim.

<LogCat>

09-18 09:45:38.701: E/AndroidRuntime(812): FATAL EXCEPTION: main
09-18 09:45:38.701: E/AndroidRuntime(812): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.frknbrgl.nerdeyim/com.frknbrgl.nerdeyim.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.frknbrgl.nerdeyim.MainActivity" on path: DexPathList[[zip file "/data/app/com.frknbrgl.nerdeyim-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.frknbrgl.nerdeyim-1, /system/lib]]
09-18 09:45:38.701: E/AndroidRuntime(812):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
09-18 09:45:38.701: E/AndroidRuntime(812):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
09-18 09:45:38.701: E/AndroidRuntime(812):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
09-18 09:45:38.701: E/AndroidRuntime(812):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
09-18 09:45:38.701: E/AndroidRuntime(812):     at android.os.Handler.dispatchMessage(Handler.java:99)
09-18 09:45:38.701: E/AndroidRuntime(812):     at android.os.Looper.loop(Looper.java:137)
09-18 09:45:38.701: E/AndroidRuntime(812):     at android.app.ActivityThread.main(ActivityThread.java:5103)
09-18 09:45:38.701: E/AndroidRuntime(812):     at java.lang.reflect.Method.invokeNative(Native Method)
09-18 09:45:38.701: E/AndroidRuntime(812):     at java.lang.reflect.Method.invoke(Method.java:525)
09-18 09:45:38.701: E/AndroidRuntime(812):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
09-18 09:45:38.701: E/AndroidRuntime(812):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-18 09:45:38.701: E/AndroidRuntime(812):     at dalvik.system.NativeStart.main(Native Method)
09-18 09:45:38.701: E/AndroidRuntime(812): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.frknbrgl.nerdeyim.MainActivity" on path: DexPathList[[zip file "/data/app/com.frknbrgl.nerdeyim-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.frknbrgl.nerdeyim-1, /system/lib]]
09-18 09:45:38.701: E/AndroidRuntime(812):     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
09-18 09:45:38.701: E/AndroidRuntime(812):     at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
09-18 09:45:38.701: E/AndroidRuntime(812):     at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
09-18 09:45:38.701: E/AndroidRuntime(812):     at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
09-18 09:45:38.701: E/AndroidRuntime(812):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
09-18 09:45:38.701: E/AndroidRuntime(812):     ... 11 more

<MainActivty>

import android.location.Location;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.widget.TextView;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks;
import com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener;
import com.google.android.gms.location.LocationClient;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;

public class MainActivity extends FragmentActivity implements ConnectionCallbacks, OnConnectionFailedListener, LocationListener {
    
    private LocationClient locationClient;
    private LocationRequest locationRequest;
    private TextView enlemTextView;
    private TextView boylamTextView;
   

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        enlemTextView = (TextView) findViewById(R.id.textView1);
        boylamTextView = (TextView) findViewById(R.id.textView2);
               
        locationClient = new LocationClient(this, this, this);
        
        locationRequest = LocationRequest.create()
                  .setInterval(5000)
                  .setFastestInterval(16)
                  .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
    }
    
    @Override
    public void onLocationChanged(Location location) {
        enlemTextView.setText(String.valueOf(location.getLatitude()));
        boylamTextView.setText(String.valueOf(location.getLongitude()));
        
            }
    

    @Override
    public void onConnected(Bundle connectionHint) {
        locationClient.requestLocationUpdates(locationRequest, this);
    }

    @Override
    public void onDisconnected() {}

    @Override
    public void onConnectionFailed(ConnectionResult result) {}

    @Override
    protected void onResume() {
        super.onResume();
        locationClient.connect();
    }

    @Override
    public void onPause() {
        super.onPause();
        
        if(locationClient.isConnected())
            locationClient.removeLocationUpdates(this);
        
        locationClient.disconnect();
    }

}

 

<AndroidManifest>

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.frknbrgl.nerdeyim"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="18"
        android:targetSdkVersion="18" />
    
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.INTERNET"/>

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

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

Maalesef <uygulama_adi> durdu. ()

Android de konum bilgimi almak istiyorum fakat sürekli ' Maalesef <uygulama_adi> durdu ' hatası alıyorum.Emilatör olarak HTC One telefonumu kullanıyorum.Herşeyi tam yaptığımı sanıyorum yardımcı olurmusunuz. google_play_services-lib kütüphanesini projeye import ettim.

<LogCat>

09-16 23:32:27.828: W/asset(2482): Copying FileAsset 0x76646d90 (zip:/data/app/com.frknbrgl.nerdeyim-1.apk:/resources.arsc) to buffer size 142268 to make it aligned.

09-16 23:32:27.848: W/dalvikvm(2482): Link of class 'Lcom/frknbrgl/nerdeyim/MainActivity;' failed

09-16 23:32:27.848: W/dalvikvm(2482): threadid=1: thread exiting with uncaught exception (group=0x416c8e18)

09-16 23:32:27.848: E/AndroidRuntime(2482): FATAL EXCEPTION: main

09-16 23:32:27.848: E/AndroidRuntime(2482): Process: com.frknbrgl.nerdeyim, PID: 2482

09-16 23:32:27.848: E/AndroidRuntime(2482): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.frknbrgl.nerdeyim/com.frknbrgl.nerdeyim.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.frknbrgl.nerdeyim.MainActivity" on path: DexPathList[[zip file "/data/app/com.frknbrgl.nerdeyim-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.frknbrgl.nerdeyim-1, /vendor/lib, /system/lib]]

09-16 23:32:27.848: E/AndroidRuntime(2482):        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2503)

09-16 23:32:27.848: E/AndroidRuntime(2482):        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2641)

09-16 23:32:27.848: E/AndroidRuntime(2482):        at android.app.ActivityThread.access$800(ActivityThread.java:156)

09-16 23:32:27.848: E/AndroidRuntime(2482):        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1355)

09-16 23:32:27.848: E/AndroidRuntime(2482):        at android.os.Handler.dispatchMessage(Handler.java:102)

09-16 23:32:27.848: E/AndroidRuntime(2482):        at android.os.Looper.loop(Looper.java:157)

09-16 23:32:27.848: E/AndroidRuntime(2482):        at android.app.ActivityThread.main(ActivityThread.java:5867)

09-16 23:32:27.848: E/AndroidRuntime(2482):        at java.lang.reflect.Method.invokeNative(Native Method)

09-16 23:32:27.848: E/AndroidRuntime(2482):        at java.lang.reflect.Method.invoke(Method.java:515)

09-16 23:32:27.848: E/AndroidRuntime(2482):        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)

09-16 23:32:27.848: E/AndroidRuntime(2482):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:674)

09-16 23:32:27.848: E/AndroidRuntime(2482):        at dalvik.system.NativeStart.main(Native Method)

09-16 23:32:27.848: E/AndroidRuntime(2482): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.frknbrgl.nerdeyim.MainActivity" on path: DexPathList[[zip file "/data/app/com.frknbrgl.nerdeyim-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.frknbrgl.nerdeyim-1, /vendor/lib, /system/lib]]

09-16 23:32:27.848: E/AndroidRuntime(2482):        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)

09-16 23:32:27.848: E/AndroidRuntime(2482):        at java.lang.ClassLoader.loadClass(ClassLoader.java:497)

09-16 23:32:27.848: E/AndroidRuntime(2482):        at java.lang.ClassLoader.loadClass(ClassLoader.java:457)

09-16 23:32:27.848: E/AndroidRuntime(2482):        at android.app.Instrumentation.newActivity(Instrumentation.java:1079)

09-16 23:32:27.848: E/AndroidRuntime(2482):        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2494)

09-16 23:32:27.848: E/AndroidRuntime(2482):        ... 11 more

09-16 23:32:31.252: D/Process(2482): killProcess, pid=2482

09-16 23:32:31.252: D/Process(2482): com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException:136 java.lang.ThreadGroup.uncaughtException:693 java.lang.ThreadGroup.uncaughtException:690

 

<MainActivty.java>

package com.frknbrgl.nerdeyim;

import java.io.IOException;
import java.util.List;
import java.util.Locale;

import android.content.Context;
import android.location.Address;
import android.location.Geocoder;
import android.location.Location;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.widget.TextView;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks;
import com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener;
import com.google.android.gms.location.LocationClient;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;

public class MainActivity extends FragmentActivity implements ConnectionCallbacks, OnConnectionFailedListener, LocationListener {
    
    private LocationClient locationClient;
    private LocationRequest locationRequest;
    private TextView enlemTextView;
    private TextView boylamTextView;
    private TextView adresTextView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        enlemTextView = (TextView) findViewById(R.id.enlemTextView);
        boylamTextView = (TextView) findViewById(R.id.boylamTextView);
        adresTextView = (TextView) findViewById(R.id.adresTextView);
        
        locationClient = new LocationClient(this, this, this);
        
        locationRequest = LocationRequest.create()
                  .setInterval(0)
                  .setFastestInterval(0)
                  .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
    }
    
    @Override
    public void onLocationChanged(Location location) {
        enlemTextView.setText(String.valueOf(location.getLatitude()));
        boylamTextView.setText(String.valueOf(location.getLongitude()));
        
        GeocodingTask task = new GeocodingTask(MainActivity.this);
        task.execute(new Location[] {location});
    }
    
private class GeocodingTask extends AsyncTask<Location, Void, String> {
        
        private Context context;

        public GeocodingTask(Context context) {
            super();
            this.context = context;
        }
        
        @Override
        protected String doInBackground(Location... params) {
            
            Location location = params[0];
            Geocoder geocoder = new Geocoder(context, new Locale("tr", "TR"));
            
            try {
                List<Address> adresListesi = geocoder.getFromLocation(location.getLatitude(), location.getLongitude(), 1);
                
                if(adresListesi != null && adresListesi.size() > 0) {
                    
                    Address adres = adresListesi.get(0);
                    String adresSatiri = adres.getMaxAddressLineIndex() > 0 ? adres.getAddressLine(0) : "";
                    String postaKodu = adres.getPostalCode();
                    String ulke = adres.getCountryName();
                    String adresString = String.format("%s, %s, %s", adresSatiri, postaKodu, ulke);
                    return adresString;
                    
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
            
            return "";
        }

        @Override
        protected void onPostExecute(String result) {
            adresTextView.setText(result);
        }
        
    }

    @Override
    public void onConnected(Bundle connectionHint) {
        locationClient.requestLocationUpdates(locationRequest, this);
    }

    @Override
    public void onDisconnected() {}

    @Override
    public void onConnectionFailed(ConnectionResult result) {}

    @Override
    protected void onResume() {
        super.onResume();
        locationClient.connect();
    }

    @Override
    public void onPause() {
        super.onPause();
        
        if(locationClient.isConnected())
            locationClient.removeLocationUpdates(this);
        
        locationClient.disconnect();
    }

}

 

<AndroidManifest.xml>

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.frknbrgl.nerdeyim"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="17"
        android:targetSdkVersion="18" />
    
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.INTERNET"/>

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

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