Hello List,
i am sorry for my question but i don´t find my misstake.
I´ve developed an app that wants to show the location koordinats.
So that is my code:
package koordinaten.xy;
import android.app.Activity;
import android.content.Context;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
public class KoordinatenActivity extends Activity implements
OnClickListener {
private Button koordinaten;
private LocationManager locationManager;
private String provider;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
koordinaten = (Button) findViewById(R.id.koordinaten_button);
koordinaten.setOnClickListener(this);
}
public void onClick(View v) {
LocationManager locManager =
(LocationManager)getSystemService(Context.LOCATION_SERVICE);
Criteria criteria = new Criteria();
!!!!LINE36 provider =
locationManager.getBestProvider(criteria, false);
Location location =
locationManager.getLastKnownLocation(provider);
if (location != null) {
System.out.println("Provider " + provider + "
has been
selected.");
int lat = (int) (location.getLatitude());
int lng = (int) (location.getLongitude());
TextView x_field = (TextView)
findViewById(R.id.koordinate_x);
x_field.setText(lat);
TextView y_field = (TextView)
findViewById(R.id.koordinate_y);
y_field.setText(lat);
} else {
int lat = 00;
int lng = 00;
TextView x_field = (TextView)
findViewById(R.id.koordinate_x);
x_field.setText(lat);
TextView y_field = (TextView)
findViewById(R.id.koordinate_y);
y_field.setText(lat);
}
}
}
and that is my manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="koordinaten.xy"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="4" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:label="@string/app_name"
android:name=".KoordinatenActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission
android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
so my eclipse means that line 36 is wrong ( i have markered that line)
but i do not know why?
can someone help me?
thanks a lot
ballibum
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en