AdevintaSpain / Leku

:earth_africa: Map location picker component for Android. Based on Google Maps. An alternative to Google Place Picker.
https://adevintaspain.github.io/Leku/
Apache License 2.0
763 stars 170 forks source link

Unable to start activity #54

Closed RmpNathan closed 7 years ago

RmpNathan commented 7 years ago

hello thanks for your work it's very cool :)

I have a problems when i click on my button i have an error :

java.lang.RuntimeException: Unable to start activity ComponentInfo{fr.wildcodeschool.hobbyhobbo/com.schibstedspain.leku.LocationPickerActivity}: android.view.InflateException: Binary XML file line #53: Error inflating class android.support.design.widget.FloatingActionButton

my code :

Manifest :

`<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="fr.wildcodeschool.hobbyhobbo">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

<uses-feature android:name="android.hardware.location.network" android:required="false" />
<uses-feature android:name="android.hardware.location.gps" android:required="false"  />

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">

    <meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version"
        />

    <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="@string/google_maps_key"
        />

    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

    <activity
        android:name="com.schibstedspain.leku.LocationPickerActivity"
        android:label="@string/title_activity_location_picker"
        android:theme="@style/Theme.AppCompat.Light.NoActionBar"
        android:windowSoftInputMode="adjustPan"
        android:parentActivityName=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.SEARCH" />
        </intent-filter>
        <meta-data android:name="android.app.searchable"
            android:resource="@xml/searchable" />
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value=".MainActivity" />
    </activity>
</application>

`

MainActivity :

` import android.content.Intent; import android.location.Address; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.Toast;

import com.schibstedspain.leku.LocationPicker; import com.schibstedspain.leku.LocationPickerActivity; import com.schibstedspain.leku.tracker.LocationPickerTracker; import com.schibstedspain.leku.tracker.TrackEvents;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Button goMarker = (Button) findViewById(R.id.button2);

    goMarker.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent intent = new Intent(MainActivity.this, LocationPickerActivity.class);
            startActivityForResult(intent, 1);
        }
    });
    initializeLocationPickerTracker();
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    if (requestCode == 1) {
        if(resultCode == RESULT_OK){
            double latitude = data.getDoubleExtra(LocationPickerActivity.LATITUDE, 0);
            Log.d("LATITUDE****", String.valueOf(latitude));
            double longitude = data.getDoubleExtra(LocationPickerActivity.LONGITUDE, 0);
            Log.d("LONGITUDE****", String.valueOf(longitude));
            String address = data.getStringExtra(LocationPickerActivity.LOCATION_ADDRESS);
            Log.d("ADDRESS****", String.valueOf(address));
            String postalcode = data.getStringExtra(LocationPickerActivity.ZIPCODE);
            Log.d("POSTALCODE****", String.valueOf(postalcode));
            Bundle bundle = data.getBundleExtra(LocationPickerActivity.TRANSITION_BUNDLE);
            Log.d("BUNDLE TEXT****", bundle.getString("test"));
            Address fullAddress = data.getParcelableExtra(LocationPickerActivity.ADDRESS);
            Log.d("FULL ADDRESS****", fullAddress.toString());
        }
        if (resultCode == RESULT_CANCELED) {
            //Write your code if there's no result
        }
    }
}

private void initializeLocationPickerTracker() {
    LocationPicker.setTracker(new LocationPickerTracker() {
        @Override
        public void onEventTracked(TrackEvents event) {
            Toast.makeText(MainActivity.this, "Event: " + event.getEventName(), Toast.LENGTH_SHORT)
                    .show();
        }
    });
}

} `

I have add dependencies, Google map api key

Can you tell me what is wrong please ? Thank's you so mutch and sorry for my english ahah

ferranpons commented 7 years ago

Hi @RmpNathan

Sorry for replying late.

I saw that you closed the issue. Did you found the problem?

If you still got the issue I could help you to try to find out the problem.

Many thanks!

RmpNathan commented 7 years ago

hey thanks you :) yes i have found the problem thanks you for your work !

It's posible to make an autocompilation in the searchbar?

do you know if it's posible to make an autocomplete in the searchbar? Thank's for your time!!

2017-01-25 12:50 GMT+01:00 Ferran Pons notifications@github.com:

Hi @RmpNathan https://github.com/RmpNathan

Sorry for replying late.

I saw that you closed the issue. Did you found the problem?

If you still got the issue I could help you to try to find out the problem.

Many thanks!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/SchibstedSpain/Leku/issues/54#issuecomment-275088669, or mute the thread https://github.com/notifications/unsubscribe-auth/ASwL3qLG7JuWjQRmqzUwAPbDXARc2feyks5rVzbzgaJpZM4LqMlm .

ferranpons commented 7 years ago

Hi @RmpNathan

I'm glad you like it! 💃

About what you ask. It's possible to make an autocomplete feature for the search. I'll get into that as soon I have time to work on it.

For now, I created an issue #55 if you want to track it. 😉

Many Thanks for your suggestion!

ferranpons commented 7 years ago

@RmpNathan is almost there. I made the PR with the feature.

https://github.com/SchibstedSpain/Leku/pull/56

ferranpons commented 7 years ago

@RmpNathan auto-complete is available with the latest version 3.0.0

Enjoy!