Search in sources :

Example 1 with DiscoveryResult

use of com.here.android.mpa.search.DiscoveryResult in project here-android-sdk-examples by heremaps.

the class ResultListAdapter method getView.

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    DiscoveryResult discoveryResult = m_discoveryResultList.get(position);
    if (convertView == null) {
        convertView = LayoutInflater.from(getContext()).inflate(R.layout.result_list_item, parent, false);
    }
    /*
         * Display title and vicinity information of each result. Please refer to HERE Android SDK
         * API doc for all supported APIs.
         */
    TextView tv = (TextView) convertView.findViewById(R.id.name);
    tv.setText(discoveryResult.getTitle());
    tv = (TextView) convertView.findViewById(R.id.vicinity);
    tv.setText(String.format("Vicinity: %s", discoveryResult.getVicinity()));
    return convertView;
}
Also used : DiscoveryResult(com.here.android.mpa.search.DiscoveryResult) TextView(android.widget.TextView)

Example 2 with DiscoveryResult

use of com.here.android.mpa.search.DiscoveryResult in project here-android-sdk-examples by heremaps.

the class ResultListActivity method onListItemClick.

/* Retrieve details of the place selected */
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    DiscoveryResult result = MapFragmentView.s_ResultList.get(position);
    if (result.getResultType() == DiscoveryResult.ResultType.PLACE) {
        /* Fire the PlaceRequest */
        PlaceLink placeLink = (PlaceLink) result;
        PlaceRequest placeRequest = placeLink.getDetailsRequest();
        placeRequest.execute(m_placeResultListener);
    } else if (result.getResultType() == DiscoveryResult.ResultType.DISCOVERY) {
        /*
             * Another DiscoveryRequest object can be obtained by calling DiscoveryLink.getRequest()
             */
        Toast.makeText(this, "This is a DiscoveryLink result", Toast.LENGTH_SHORT).show();
    }
}
Also used : PlaceLink(com.here.android.mpa.search.PlaceLink) PlaceRequest(com.here.android.mpa.search.PlaceRequest) DiscoveryResult(com.here.android.mpa.search.DiscoveryResult)

Example 3 with DiscoveryResult

use of com.here.android.mpa.search.DiscoveryResult in project here-android-sdk-examples by heremaps.

the class ResultListActivity method onListItemClick.

/* Retrieve details of the place selected */
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    DiscoveryResult result = MapFragmentView.s_discoverResultList.get(position);
    if (result.getResultType() == DiscoveryResult.ResultType.PLACE) {
        /* Fire the PlaceRequest */
        PlaceLink placeLink = (PlaceLink) result;
        PlaceRequest placeRequest = placeLink.getDetailsRequest();
        placeRequest.execute(m_placeResultListener);
    } else if (result.getResultType() == DiscoveryResult.ResultType.DISCOVERY) {
        /*
             * Another DiscoveryRequest object can be obtained by calling DiscoveryLink.getRequest()
             */
        Toast.makeText(this, "This is a DiscoveryLink result", Toast.LENGTH_SHORT).show();
    }
}
Also used : PlaceLink(com.here.android.mpa.search.PlaceLink) PlaceRequest(com.here.android.mpa.search.PlaceRequest) DiscoveryResult(com.here.android.mpa.search.DiscoveryResult)

Example 4 with DiscoveryResult

use of com.here.android.mpa.search.DiscoveryResult in project here-android-sdk-examples by heremaps.

the class ResultListAdapter method getView.

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    DiscoveryResult discoveryResult = m_discoveryResultList.get(position);
    if (convertView == null) {
        convertView = LayoutInflater.from(getContext()).inflate(R.layout.result_list_item, parent, false);
    }
    /*
         * Display title and vicinity information of each result.Please refer to HERE Android SDK
         * API doc for all supported APIs.
         */
    TextView tv = (TextView) convertView.findViewById(R.id.name);
    tv.setText(discoveryResult.getTitle());
    tv = (TextView) convertView.findViewById(R.id.vicinity);
    tv.setText(String.format("Vicinity: %s", discoveryResult.getVicinity()));
    return convertView;
}
Also used : DiscoveryResult(com.here.android.mpa.search.DiscoveryResult) TextView(android.widget.TextView)

Aggregations

DiscoveryResult (com.here.android.mpa.search.DiscoveryResult)4 TextView (android.widget.TextView)2 PlaceLink (com.here.android.mpa.search.PlaceLink)2 PlaceRequest (com.here.android.mpa.search.PlaceRequest)2