Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to start activity #54

Closed
RmpNathan opened this issue Jan 21, 2017 · 5 comments
Closed

Unable to start activity #54

RmpNathan opened this issue Jan 21, 2017 · 5 comments

Comments

@RmpNathan
Copy link

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 :

`

<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
Copy link
Member

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
Copy link
Author

RmpNathan commented Jan 30, 2017 via email

@ferranpons
Copy link
Member

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
Copy link
Member

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

#56

@ferranpons
Copy link
Member

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

Enjoy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants