Quantcast
Channel: BTSoru.com - Bilisim ve Yazilim Teknolojileri Soru/Cevap Platformu - latest questions
Viewing all articles
Browse latest Browse all 4270

requestLocationUpdates SORUNU

$
0
0

aşağıda paylaştığım kodda sadece locationmanager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationlistener); hata veriyor nedeni bilen varsa yardım edebilir mi?? teşekkürler.

package com.example.musab.myapplication;

import android.os.Bundle;

import android.support.v7.app.AppCompatActivity;

import android.location.Location;

import android.location.LocationListener;

import android.location.LocationManager;

import android.app.Activity;

import android.content.Context;

import android.view.Menu;

import android.view.View;

import android.view.View.OnClickListener;

import android.widget.Button;

import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

Button btnShow;

TextView lat, longi;

LocationManager locationmanager;

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

lat = (TextView) findViewById(R.id.textView2);

longi = (TextView) findViewById(R.id.textView);

btnShow = (Button) findViewById(R.id.button );

btnShow.setOnClickListener(new OnClickListener() {

@Override

public void onClick(View v) {

locationmanager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);

LocationListener locationlistener = new MyLocationListener();

locationmanager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationlistener);

}

});

}

public class MyLocationListener implements LocationListener {

@Override

public void onLocationChanged(Location location) {

String latitude = "" + location.getLatitude();

String longitude = "" + location.getLongitude();

lat.setText(latitude);

longi.setText(longitude);

}

@Override

public void onProviderDisabled(String arg0) { }

@Override

public void onProviderEnabled(String arg0) { }

@Override

public void onStatusChanged(String arg0, int arg1, Bundle arg2)

{ // TODO Auto-generated method stub }

}

}


Viewing all articles
Browse latest Browse all 4270

Trending Articles


huddam daveti


Tekasür Suresi


"Yâ Kuddûs!" Esması Havâs ve Esrârı


Kasemi Mübelliğa


Peri44


Kuvvetli muhabbet ve aşk tılsımı


El-Mütekebbir


Papaz büyüsü


SCCM 2012 Client Installation issue


Zilhicce Ayının Namaz Duası ÖNEMLİ