Z
Zockerratte
Neues Mitglied
- 0
Hi
Ich habe einen sporadischen Fehler, mit dem ich einfach nicht zurecht komme.
All zu viel Erfahrung, in der App Programmierung, habe ich bisher nicht, daher bitte auch die typischen Anfängerfehler mit berücksichtigen.
Und wer einen guten Tipp in allgemeinen Dingen hat, immer raus damit
Ich möchte in meiner App über ein Intent die Kamera Funktion aufrufen und das Bild innerhalb meiner App speichern. Das funktioniert an sich auch, allerdings nicht immer! Total sporadisch wird die App angehalten, nachdem die Kamera beendet wird. Manchmal geht sie immer, bis ich im Code was verändere, manchmal muss ich in Eclipse das Projekt neu bauen lassen (clean) und manchmal geht es das eine Mal und das nächte mal wieder nicht.
Aus den Lockcat Einträgen (siehe unten) werd ich auch nicht schlau. Ich bin zwar soweit, zu sehen, in welcher Zeile meines Programmes es crashen soll, aber das ergibt für mich keinen Sinn.
Meiner Interpretation nach soll der Fehler im Konstruktor der Klasse FragmentAddSight, bei folgendem Aufruf auftreten:
Allerdings komme ich gar nicht bis zu dieser Stelle, wenn ich mein Programm debugge. Sprich der Fehler tritt auf, bevor er den Breakpoint in dieser Zeile erreicht.
Was mich ebenfalls SEHR stutzig gemacht hat, ist dass meine Activity jedes Mal neu erstellt wird, nachdem sie wieder in den Vordergrund rückt. Also auch, wenn ich auf den Homebutton drücke und dann wieder auf die App gehe.
Da stellt sich für mich die Frage wieso tut sie das??? Bzw. wofür gibt es denn dann eine onResume() Methode?
Ich hoffe, ich habe keine Info vergessen und irgend jemand hat eine Idee, woran es klemmt...
Ach ja, ich arbeite mit Eclipse und nem LG G2 mini. Und wer dir restlichen Klassen sehen will, einfach bescheid sagen.
LockCat:
02-02 13:01:55.966: E/AndroidRuntime(20640): FATAL EXCEPTION: main
02-02 13:01:55.966: E/AndroidRuntime(20640): Process: com.example.stadtfuehrer, PID: 20640
02-02 13:01:55.966: E/AndroidRuntime(20640): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.stadtfuehrer/com.example.stadtfuehrer.MainActivity}: java.lang.NullPointerException
02-02 13:01:55.966: E/AndroidRuntime(20640): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2202)
02-02 13:01:55.966: E/AndroidRuntime(20640): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2252)
02-02 13:01:55.966: E/AndroidRuntime(20640): at android.app.ActivityThread.access$800(ActivityThread.java:139)
02-02 13:01:55.966: E/AndroidRuntime(20640): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1200)
02-02 13:01:55.966: E/AndroidRuntime(20640): at android.os.Handler.dispatchMessage(Handler.java:102)
02-02 13:01:55.966: E/AndroidRuntime(20640): at android.os.Looper.loop(Looper.java:136)
02-02 13:01:55.966: E/AndroidRuntime(20640): at android.app.ActivityThread.main(ActivityThread.java:5103)
02-02 13:01:55.966: E/AndroidRuntime(20640): at java.lang.reflect.Method.invokeNative(Native Method)
02-02 13:01:55.966: E/AndroidRuntime(20640): at java.lang.reflect.Method.invoke(Method.java:515)
02-02 13:01:55.966: E/AndroidRuntime(20640): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
02-02 13:01:55.966: E/AndroidRuntime(20640): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:606)
02-02 13:01:55.966: E/AndroidRuntime(20640): at dalvik.system.NativeStart.main(Native Method)
02-02 13:01:55.966: E/AndroidRuntime(20640): Caused by: java.lang.NullPointerException
02-02 13:01:55.966: E/AndroidRuntime(20640): at com.example.stadtfuehrer.FragmentAddSight.<init>(FragmentAddSight.java:43)
02-02 13:01:55.966: E/AndroidRuntime(20640): at java.lang.Class.newInstanceImpl(Native Method)
02-02 13:01:55.966: E/AndroidRuntime(20640): at java.lang.Class.newInstance(Class.java:1208)
02-02 13:01:55.966: E/AndroidRuntime(20640): at android.support.v4.app.Fragment.instantiate(Fragment.java:420)
02-02 13:01:55.966: E/AndroidRuntime(20640): at android.support.v4.app.FragmentState.instantiate(Fragment.java:101)
02-02 13:01:55.966: E/AndroidRuntime(20640): at android.support.v4.app.FragmentManagerImpl.restoreAllState(FragmentManager.java:1823)
02-02 13:01:55.966: E/AndroidRuntime(20640): at android.support.v4.app.FragmentActivity.onCreate(FragmentActivity.java:264)
02-02 13:01:55.966: E/AndroidRuntime(20640): at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:122)
02-02 13:01:55.966: E/AndroidRuntime(20640): at com.example.stadtfuehrer.MainActivity.onCreate(MainActivity.java:42)
02-02 13:01:55.966: E/AndroidRuntime(20640): at android.app.Activity.performCreate(Activity.java:5275)
02-02 13:01:55.966: E/AndroidRuntime(20640): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
02-02 13:01:55.966: E/AndroidRuntime(20640): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2166)
02-02 13:01:55.966: E/AndroidRuntime(20640): ... 11 more
MainActivity (leider etwas unübersichtlich):
FragmentAddSight:
Ich habe einen sporadischen Fehler, mit dem ich einfach nicht zurecht komme.
All zu viel Erfahrung, in der App Programmierung, habe ich bisher nicht, daher bitte auch die typischen Anfängerfehler mit berücksichtigen.
Und wer einen guten Tipp in allgemeinen Dingen hat, immer raus damit
Ich möchte in meiner App über ein Intent die Kamera Funktion aufrufen und das Bild innerhalb meiner App speichern. Das funktioniert an sich auch, allerdings nicht immer! Total sporadisch wird die App angehalten, nachdem die Kamera beendet wird. Manchmal geht sie immer, bis ich im Code was verändere, manchmal muss ich in Eclipse das Projekt neu bauen lassen (clean) und manchmal geht es das eine Mal und das nächte mal wieder nicht.
Aus den Lockcat Einträgen (siehe unten) werd ich auch nicht schlau. Ich bin zwar soweit, zu sehen, in welcher Zeile meines Programmes es crashen soll, aber das ergibt für mich keinen Sinn.
Meiner Interpretation nach soll der Fehler im Konstruktor der Klasse FragmentAddSight, bei folgendem Aufruf auftreten:
Code:
[SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]
geocoder[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Geocoder(MainActivity.[I]getInstance[/I]().getApplicationContext());
[/SIZE]
Was mich ebenfalls SEHR stutzig gemacht hat, ist dass meine Activity jedes Mal neu erstellt wird, nachdem sie wieder in den Vordergrund rückt. Also auch, wenn ich auf den Homebutton drücke und dann wieder auf die App gehe.
Da stellt sich für mich die Frage wieso tut sie das??? Bzw. wofür gibt es denn dann eine onResume() Methode?
Ich hoffe, ich habe keine Info vergessen und irgend jemand hat eine Idee, woran es klemmt...
Ach ja, ich arbeite mit Eclipse und nem LG G2 mini. Und wer dir restlichen Klassen sehen will, einfach bescheid sagen.
LockCat:
02-02 13:01:55.966: E/AndroidRuntime(20640): FATAL EXCEPTION: main
02-02 13:01:55.966: E/AndroidRuntime(20640): Process: com.example.stadtfuehrer, PID: 20640
02-02 13:01:55.966: E/AndroidRuntime(20640): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.stadtfuehrer/com.example.stadtfuehrer.MainActivity}: java.lang.NullPointerException
02-02 13:01:55.966: E/AndroidRuntime(20640): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2202)
02-02 13:01:55.966: E/AndroidRuntime(20640): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2252)
02-02 13:01:55.966: E/AndroidRuntime(20640): at android.app.ActivityThread.access$800(ActivityThread.java:139)
02-02 13:01:55.966: E/AndroidRuntime(20640): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1200)
02-02 13:01:55.966: E/AndroidRuntime(20640): at android.os.Handler.dispatchMessage(Handler.java:102)
02-02 13:01:55.966: E/AndroidRuntime(20640): at android.os.Looper.loop(Looper.java:136)
02-02 13:01:55.966: E/AndroidRuntime(20640): at android.app.ActivityThread.main(ActivityThread.java:5103)
02-02 13:01:55.966: E/AndroidRuntime(20640): at java.lang.reflect.Method.invokeNative(Native Method)
02-02 13:01:55.966: E/AndroidRuntime(20640): at java.lang.reflect.Method.invoke(Method.java:515)
02-02 13:01:55.966: E/AndroidRuntime(20640): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
02-02 13:01:55.966: E/AndroidRuntime(20640): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:606)
02-02 13:01:55.966: E/AndroidRuntime(20640): at dalvik.system.NativeStart.main(Native Method)
02-02 13:01:55.966: E/AndroidRuntime(20640): Caused by: java.lang.NullPointerException
02-02 13:01:55.966: E/AndroidRuntime(20640): at com.example.stadtfuehrer.FragmentAddSight.<init>(FragmentAddSight.java:43)
02-02 13:01:55.966: E/AndroidRuntime(20640): at java.lang.Class.newInstanceImpl(Native Method)
02-02 13:01:55.966: E/AndroidRuntime(20640): at java.lang.Class.newInstance(Class.java:1208)
02-02 13:01:55.966: E/AndroidRuntime(20640): at android.support.v4.app.Fragment.instantiate(Fragment.java:420)
02-02 13:01:55.966: E/AndroidRuntime(20640): at android.support.v4.app.FragmentState.instantiate(Fragment.java:101)
02-02 13:01:55.966: E/AndroidRuntime(20640): at android.support.v4.app.FragmentManagerImpl.restoreAllState(FragmentManager.java:1823)
02-02 13:01:55.966: E/AndroidRuntime(20640): at android.support.v4.app.FragmentActivity.onCreate(FragmentActivity.java:264)
02-02 13:01:55.966: E/AndroidRuntime(20640): at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:122)
02-02 13:01:55.966: E/AndroidRuntime(20640): at com.example.stadtfuehrer.MainActivity.onCreate(MainActivity.java:42)
02-02 13:01:55.966: E/AndroidRuntime(20640): at android.app.Activity.performCreate(Activity.java:5275)
02-02 13:01:55.966: E/AndroidRuntime(20640): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
02-02 13:01:55.966: E/AndroidRuntime(20640): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2166)
02-02 13:01:55.966: E/AndroidRuntime(20640): ... 11 more
MainActivity (leider etwas unübersichtlich):
Code:
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]
[LEFT]package[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] com.example.stadtfuehrer;
[/LEFT]
[/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f][LEFT]//import android.app.Activity;[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] java.util.ArrayList;[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] android.support.v4.app.FragmentTransaction;[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] android.support.v4.app.Fragment;[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] android.location.Location;[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] android.location.LocationListener;[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] android.location.LocationManager;[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] android.os.Bundle;[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] android.os.SystemClock;[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] android.support.v7.app.ActionBarActivity;[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] android.view.Menu;[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] android.view.MenuItem;[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] android.widget.Toast;
[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]public[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]class[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] MainActivity [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]extends[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ActionBarActivity [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]implements[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] LocationListener {
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]private[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]static[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] MainActivity [/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]singleton[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]private[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] LocationManager [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]locationManager[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]private[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Location [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]currentGpsPosition[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]null[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]private[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]long[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]timeStampGps[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = 0;
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]private[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Location [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]currentNetworkPosition[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]null[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]private[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]long[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]timeStampNetwork[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = 0;
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]boolean[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]isNavigationUnavailable[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]true[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]final[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ArrayList<Sights> [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]sightsList[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ArrayList<Sights>();
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]final[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] FragmentTransaction [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]transaction[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = getSupportFragmentManager().beginTransaction();
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]final[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Fragment [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]mainFragment[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] FragmentMain();
[/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]//final Fragment mainFragment = new FragmentAddSight();[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT]
[/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// Returns the application instance [/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]static[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] MainActivity getInstance() {
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]return[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]singleton[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
}
[/SIZE][SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464]@Override[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]protected[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] onCreate(Bundle savedInstanceState) {
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]super[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].onCreate(savedInstanceState);
[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]singleton[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]this[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]locationManager[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = (LocationManager) [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]this[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].getSystemService([/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]LOCATION_SERVICE[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);
getData([/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]sightsList[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);
setContentView(R.layout.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]activity_main[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (savedInstanceState == [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]null[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]) {
[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]transaction[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].add(R.id.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]container[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]mainFragment[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]).commit();
}
Toast.[I]makeText[/I](MainActivity.[I]getInstance[/I]().getApplicationContext(), [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"onCreate"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], Toast.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]LENGTH_SHORT[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]).show();
}
[/SIZE][SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464]@Override[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]protected[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] onStart(){
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]super[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].onStart();
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]locationManager[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].isProviderEnabled(LocationManager.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]GPS_PROVIDER[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2])){
[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]locationManager[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].requestLocationUpdates(LocationManager.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]GPS_PROVIDER[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], 10000, 0, [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]this[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);
[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]isNavigationUnavailable[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]false[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
}
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]locationManager[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].isProviderEnabled(LocationManager.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]NETWORK_PROVIDER[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2])){
[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]locationManager[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].requestLocationUpdates(LocationManager.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]NETWORK_PROVIDER[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], 10000, 0, [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]this[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);
[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]isNavigationUnavailable[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]false[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
}
}
[/SIZE][SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464]@Override[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]protected[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] onStop(){
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]super[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].onStop();
[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]locationManager[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].removeUpdates([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]this[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);
}
[/SIZE][SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464]@Override[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]boolean[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] onCreateOptionsMenu(Menu menu) {
[/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// Inflate the menu; this adds items to the action bar if it is present.[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT]getMenuInflater().inflate(R.menu.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]main[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], menu);
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]return[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]true[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
}
[/SIZE][SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464]@Override[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]boolean[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] onOptionsItemSelected(MenuItem item) {
[/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// Handle action bar item clicks here. The action bar will[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// automatically handle clicks on the Home/Up button, so long[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// as you specify a parent activity in AndroidManifest.xml.[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] id = item.getItemId();
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (id == R.id.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]action_settings[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]) {
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]return[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]true[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
}
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]return[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]super[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].onOptionsItemSelected(item);
}
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ArrayList<Sights> getSightsList() {
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]return[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]sightsList[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
}
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Location getPosition(){
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]currentGpsPosition[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]!=[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]null[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]){
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]((SystemClock.[I]elapsedRealtime[/I]()-[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]timeStampGps[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2])<25000){
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]return[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]currentGpsPosition[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
}
}
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]currentNetworkPosition[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]!=[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]null[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]){
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]((SystemClock.[I]elapsedRealtime[/I]()-[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]timeStampNetwork[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2])<25000){
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]return[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]currentNetworkPosition[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
}
}
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]return[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]null[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
}
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] getData(ArrayList<Sights> liste){
liste.add([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Sights([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"Speicher"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], 5));
liste.add([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Sights([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"El Abuelo"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], 4));
liste.add([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Sights([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"Fallenbengel"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], 3));
liste.add([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Sights([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"Alte Färbe"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], 5));
liste.add([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Sights([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"Bierengel"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], 4));
}
[/SIZE][SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464]@Override[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] onLocationChanged(Location location) {
[/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// [/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2][COLOR=#7f9fbf][SIZE=2][COLOR=#7f9fbf]TODO[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f] Auto-generated method stub[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2](location.getProvider().equals(LocationManager.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]GPS_PROVIDER[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2])){
[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]currentGpsPosition[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = location;
[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]timeStampGps[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = SystemClock.[I]elapsedRealtime[/I]();
}
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2](location.getProvider().equals(LocationManager.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]NETWORK_PROVIDER[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2])){
[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]currentNetworkPosition[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = location;
[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]timeStampNetwork[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = SystemClock.[I]elapsedRealtime[/I]();
}
}
[/SIZE][SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464]@Override[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] onStatusChanged(String provider, [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] status, Bundle extras) {
[/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// [/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2][COLOR=#7f9fbf][SIZE=2][COLOR=#7f9fbf]TODO[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f] Auto-generated method stub[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT]
}
[/SIZE][SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464]@Override[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] onProviderEnabled(String provider) {
[/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// [/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2][COLOR=#7f9fbf][SIZE=2][COLOR=#7f9fbf]TODO[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f] Auto-generated method stub[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT]
}
[/SIZE][SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464]@Override[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] onProviderDisabled(String provider) {
[/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// [/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2][COLOR=#7f9fbf][SIZE=2][COLOR=#7f9fbf]TODO[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f] Auto-generated method stub[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT]
}[/LEFT]
}
[/SIZE]
FragmentAddSight:
Code:
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]
[LEFT]package[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] com.example.stadtfuehrer;
[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] java.io.IOException;[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] java.util.ArrayList;[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] java.util.List;
[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] android.app.Activity;[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] android.content.Intent;[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] android.graphics.Bitmap;[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] android.location.Address;[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] android.location.Geocoder;[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] android.location.Location;[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] android.os.Bundle;[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] android.support.v4.app.Fragment;[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [U]android.support.v4.app.FragmentTransaction[/U];[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [U]android.support.v7.widget.LinearLayoutManager[/U];[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [U]android.support.v7.widget.RecyclerView[/U];[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] android.view.LayoutInflater;[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] android.view.View;[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] android.view.ViewGroup;[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] android.widget.EditText;[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [U]android.widget.ImageButton[/U];[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] android.widget.ImageView;[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]import[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] android.widget.Toast;
[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]public[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]class[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] FragmentAddSight [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]extends[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Fragment [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]implements[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] View.OnClickListener {
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]static[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]final[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]INTENT_ID_CAMERA[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = 123;
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]private[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Geocoder [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]geocoder[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]private[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Location [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]position[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]private[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] List<Address> [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]currentAddress[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]private[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ArrayList<Sights> [/SIZE][U][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]sightList[/U][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]private[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ImageView [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]takePicture[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]private[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ImageView [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]saveNewSight[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]private[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] EditText [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]streetName[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]private[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] EditText [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]postalCode[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]private[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] EditText [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]cityName[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]private[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Sights [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]newSight[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Sights();
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] FragmentAddSight(){
[/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]//sightList = MainActivity.getInstance().sightsList;[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]geocoder[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Geocoder(MainActivity.[I]getInstance[/I]().getApplicationContext());
[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]position[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = MainActivity.[I]getInstance[/I]().getPosition();
}
[/SIZE][SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464]@Override[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]fragment_add_sight[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], container, [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]false[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);
[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]takePicture[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = (ImageView)rootView.findViewById(R.id.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]add_takePicture[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);
[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]saveNewSight[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = (ImageView)rootView.findViewById(R.id.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]add_saveNewSight[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);
[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]streetName[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = (EditText)rootView.findViewById(R.id.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]add_streetName[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);
[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]postalCode[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = (EditText)rootView.findViewById(R.id.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]add_postalCode[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);
[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]cityName[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = (EditText)rootView.findViewById(R.id.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]add_cityName[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);
[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]takePicture[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].setOnClickListener([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]this[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);
[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]saveNewSight[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].setOnClickListener([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]this[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]position[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]!=[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]null[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]){
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]try[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] {
[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]currentAddress[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]geocoder[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].getFromLocation([/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]position[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].getLatitude(), [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]position[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].getLongitude(), 1);
}
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]catch[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (IOException e) {
[/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// [/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2][COLOR=#7f9fbf][SIZE=2][COLOR=#7f9fbf]TODO[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f] Auto-generated catch block[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT]e.printStackTrace();
}
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]currentAddress[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] != [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]null[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]){
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]currentAddress[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].get(0).getMaxAddressLineIndex()>0) [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]streetName[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].setText([/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]currentAddress[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].get(0).getAddressLine(0));
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]else[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]streetName[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].setText([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"Strasse unbekannt"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);
[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]postalCode[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].setText([/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]currentAddress[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].get(0).getPostalCode());
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]postalCode[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].equals([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]""[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2])) [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]postalCode[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].setText([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"PLZ unbekannt"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);
[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]cityName[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].setText([/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]currentAddress[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].get(0).getSubLocality());
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]cityName[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].equals([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]""[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2])) [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]cityName[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].setText([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"Stadtname unbekannt"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);
}
}
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]else[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]{
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]streetName[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].getText().toString().equals([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]""[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]) && [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]postalCode[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].getText().toString().equals([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]""[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]) && [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]cityName[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].getText().toString().equals([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]""[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2])){
[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]streetName[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].setText([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"Strasse Hausnummer"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);
[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]postalCode[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].setText([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"PLZ"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);
[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]cityName[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].setText([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"Stadt"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);
}
}
[/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]/*
if(position!=null){
//double test = position.getLatitude();
Toast.makeText(MainActivity.getInstance().getApplicationContext(), Double.toString(position.getLatitude()), Toast.LENGTH_SHORT).show();
}
else Toast.makeText(MainActivity.getInstance().getApplicationContext(), "leer", Toast.LENGTH_SHORT).show();
*/[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]//Toast.makeText(MainActivity.getInstance().getApplicationContext(), currentAddress.get(0).getPostalCode(), Toast.LENGTH_SHORT).show();[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]//Toast.makeText(MainActivity.getInstance().getApplicationContext(), Double.toString(position.getLatitude()), Toast.LENGTH_SHORT).show();[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]return[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] rootView;
}
[/SIZE][SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464]@Override[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] onClick(View v) {
[/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// [/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2][COLOR=#7f9fbf][SIZE=2][COLOR=#7f9fbf]TODO[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f] Auto-generated method stub[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]//Toast.makeText(v.getContext(), "Item clicked. ", Toast.LENGTH_SHORT).show();[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]switch[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2](v.getId()){
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]case[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] R.id.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]add_takePicture[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]:{
startActivityForResult([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Intent(android.provider.MediaStore.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]ACTION_IMAGE_CAPTURE[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]), [/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]INTENT_ID_CAMERA[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]break[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
}
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]case[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] R.id.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]add_saveNewSight[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]:{
[/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]//Toast.makeText(MainActivity.getInstance().getApplicationContext(), "Item clicked. ", Toast.LENGTH_SHORT).show();[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT]String address = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] String();
address = [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]streetName[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].getText().toString() + [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]", "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]postalCode[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].getText().toString() + [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]", "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]cityName[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].getText().toString();
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]try[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] {
[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]currentAddress[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]geocoder[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].getFromLocationName(address, 1);
} [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]catch[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (IOException e) {
[/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// [/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2][COLOR=#7f9fbf][SIZE=2][COLOR=#7f9fbf]TODO[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f] Auto-generated catch block[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT]e.printStackTrace();
}
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]currentAddress[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].get(0) != [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]null[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]){
[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]newSight[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].setStreet([/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]streetName[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].getText().toString());
[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]newSight[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].setPostalCode([/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]postalCode[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].getText().toString());
[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]newSight[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].setCity([/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]cityName[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].getText().toString());
Toast.[I]makeText[/I](MainActivity.[I]getInstance[/I]().getApplicationContext(), Double.[I]toString[/I]([/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]currentAddress[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].get(0).getLongitude()) + [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]" "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + Double.[I]toString[/I]([/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]currentAddress[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].get(0).getLongitude()), Toast.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]LENGTH_SHORT[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]).show();
}
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]else[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Toast.[I]makeText[/I](v.getContext(), [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"Objekt nicht gefunden"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], Toast.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]LENGTH_SHORT[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]).show();
MainActivity.[I]getInstance[/I]().[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]sightsList[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].add([/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]newSight[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]break[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];
}
}
}
[/SIZE][SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464]@Override[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] onActivityResult([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] requestCode, [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] resultCode, Intent data) {
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (requestCode == [/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]INTENT_ID_CAMERA[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]) {
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2](resultCode == Activity.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]RESULT_OK[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]){
[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]newSight[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]picture[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = (Bitmap) data.getExtras().get([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"data"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);
[/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]//Bitmap thumb = (Bitmap) data.getExtras().get("data"); [/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]//saveNewSight.setImageBitmap(thumb);[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT]}
}
}
}[/LEFT]
[/SIZE]