List of usage examples for android.view.inputmethod InputMethodManager hideSoftInputFromWindow
public boolean hideSoftInputFromWindow(IBinder windowToken, int flags)
From source file:app.clirnet.com.clirnetapp.activity.LoginActivity.java
private void hideKeyBoard() { InputMethodManager inputManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); try {/*from w w w. ja va 2 s . co m*/ inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } catch (Exception e) { e.printStackTrace(); } }
From source file:sjizl.com.ChatActivity.java
public void hideSoftKeyboard() { if (getCurrentFocus() != null) { InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); }//from w w w .ja v a 2 s.c om }
From source file:name.setup.dance.DanceStepApp.java
/** Called when the activity is first created. */ @Override//from ww w .ja v a2 s . co m public void onCreate(Bundle savedInstanceState) { Log.i(TAG, "[ACTIVITY] onCreate"); super.onCreate(savedInstanceState); //mStepValue = 0; mPaceValue = 0; setContentView(R.layout.main); mUtils = Utils.getInstance(); String m_szDevIDShort = "35" + //we make this look like a valid IMEI Build.BOARD.length() % 10 + Build.BRAND.length() % 10 + Build.CPU_ABI.length() % 10 + Build.DEVICE.length() % 10 + Build.DISPLAY.length() % 10 + Build.HOST.length() % 10 + Build.ID.length() % 10 + Build.MANUFACTURER.length() % 10 + Build.MODEL.length() % 10 + Build.PRODUCT.length() % 10 + Build.TAGS.length() % 10 + Build.TYPE.length() % 10 + Build.USER.length() % 10; //13 digits mUtils.DeviceName = m_szDevIDShort; Log.v(TAG, "ID: " + m_szDevIDShort); Log.v(TAG, "UTILS: " + mUtils.DeviceName); // user name mTextField = (EditText) findViewById(R.id.name_area); mTextField.setCursorVisible(false); if (!(mUtils.UserName == "My Name")) { mTextField.setText(mUtils.UserName); } mTextField.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Perform action on click InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); // only will trigger it if no physical keyboard is open mgr.showSoftInput(mTextField, InputMethodManager.SHOW_IMPLICIT); mTextField.requestFocus(); mTextField.setCursorVisible(true); mOkayButton.setVisibility(View.VISIBLE); } }); // init okay Button mOkayButton = (Button) findViewById(R.id.okay_button); mOkayButton.setVisibility(View.INVISIBLE); mOkayButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Perform action on click InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); mgr.hideSoftInputFromWindow(getWindow().getCurrentFocus().getWindowToken(), 0); mTextField.setCursorVisible(false); mTextField.clearFocus(); mUtils.UserName = mTextField.getText().toString(); // post name via HHTP new Thread(new Runnable() { public void run() { if (mIsMetric) { postHTTP(mUtils.DeviceName, mUtils.UserName, mStepValue, mDistanceValue); } else { postHTTP(mUtils.DeviceName, mUtils.UserName, mStepValue, mDistanceValue * 1.609344f); } } }).start(); mOkayButton.setVisibility(View.INVISIBLE); // Post TOAST MESSAGE Toast.makeText(getApplicationContext(), getText(R.string.name_saved), Toast.LENGTH_SHORT).show(); } }); // init Score Button mScoreButton = (Button) findViewById(R.id.scoreButton); mScoreButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Perform action on click String url = "http://www.setup.nl/tools/dancestep_app/index.php?id=" + mUtils.DeviceName + "&time=" + System.currentTimeMillis(); Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); startActivity(i); } }); }
From source file:com.android.music.MusicBrowserActivity.java
/** * M: init search button, set on click listener and search dialog on dismiss * listener, disable search button/*from w w w . ja v a 2 s.com*/ * when search dialog has shown and enable it after dismiss search dialog. */ private void initSearchButton() { mSearchButton = (ImageButton) findViewById(R.id.search_menu_nowplaying); final View blankView = this.findViewById(R.id.blank_between_search_and_overflow); final View nowPlayingView = this.findViewById(R.id.nowplaying); if (mSearchButton != null) { mSearchButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mOverflowMenuButton != null) { mOverflowMenuButton.setEnabled(false); } mSearchButton.setVisibility(View.GONE); onSearchRequested(); if (blankView.getVisibility() == View.VISIBLE) { blankView.setVisibility(View.GONE); } mSearchViewShowing = true; } }); SearchManager searchManager = (SearchManager) this.getSystemService(Context.SEARCH_SERVICE); searchManager.setOnDismissListener(new SearchManager.OnDismissListener() { @Override public void onDismiss() { if (mOverflowMenuButton != null) { mOverflowMenuButton.setEnabled(true); } mSearchButton.setVisibility(View.VISIBLE); if (nowPlayingView.getVisibility() != View.VISIBLE && !mHasMenukey) { blankView.setVisibility(View.VISIBLE); } mSearchViewShowing = false; InputMethodManager imm = (InputMethodManager) getApplicationContext() .getSystemService(Context.INPUT_METHOD_SERVICE); if (imm != null) { MusicLogUtils.d(TAG, "IIME getService failed"); } MusicLogUtils.d(TAG, "IME getService success"); if (imm != null) { MusicLogUtils.d(TAG, "Search Dialog hiding the IME"); imm.hideSoftInputFromWindow(mSearchButton.getWindowToken(), 0); } MusicLogUtils.d(TAG, "Search dialog on dismiss, enalbe search button"); } }); } }
From source file:com.BeatYourRecord.SubmitActivity.java
private void hideKeyboard(View currentFocusView) { if (currentFocusView instanceof EditText) { InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(currentFocusView.getWindowToken(), 0); requestDummyFocus();/*from w w w .j a v a 2s.c om*/ } }
From source file:it.chefacile.app.MainActivity.java
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mContext = this; chefacileDb = new DatabaseHelper(this); // FilterButton = (ImageButton) findViewById(R.id.buttonfilter); TutorialButton = (ImageButton) findViewById(R.id.button); // AddButton = (ImageButton) findViewById(R.id.button2); responseView = (TextView) findViewById(R.id.responseView); editText = (EditText) findViewById(R.id.ingredientText); progressBar = (ProgressBar) findViewById(R.id.progressBar); //Show = (ImageButton) findViewById(R.id.buttonShow); //Show2 = (ImageButton) findViewById(R.id.buttonShow2); materialAnimatedSwitch = (MaterialAnimatedSwitch) findViewById(R.id.pin); //buttoncuisine = (ImageButton) findViewById(R.id.btn_cuisine); //buttondiet = (ImageButton) findViewById(R.id.btn_diet); //buttonintol = (ImageButton) findViewById(R.id.btn_intoll); //Mostra = (Button) findViewById(R.id.btn_mostra); final Animation animation = new AlphaAnimation(1, 0); // Change alpha from fully visible to invisible animation.setDuration(1000); // duration - half a second animation.setInterpolator(new LinearInterpolator()); // do not alter animation rate animation.setRepeatCount(5); // Repeat animation infinitely animation.setRepeatMode(Animation.REVERSE); ImageView icon = new ImageView(this); // Create an icon icon.setImageDrawable(getResources().getDrawable(R.drawable.logo)); final com.oguzdev.circularfloatingactionmenu.library.FloatingActionButton actionButton = new com.oguzdev.circularfloatingactionmenu.library.FloatingActionButton.Builder( this).setPosition( com.oguzdev.circularfloatingactionmenu.library.FloatingActionButton.POSITION_RIGHT_CENTER) .setContentView(icon).build(); SubActionButton.Builder itemBuilder = new SubActionButton.Builder(this); // repeat many times: ImageView dietIcon = new ImageView(this); dietIcon.setImageDrawable(getResources().getDrawable(R.drawable.diet)); SubActionButton button1 = itemBuilder.setContentView(dietIcon).build(); button1.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { showSingleChoiceDialogDiet(v); }//from w w w . ja v a 2 s . com }); ImageView intolIcon = new ImageView(this); intolIcon.setImageDrawable(getResources().getDrawable(R.drawable.intoll)); SubActionButton button2 = itemBuilder.setContentView(intolIcon).build(); button2.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { showMultiChoiceDialogIntol(v); } }); ImageView cuisineIcon = new ImageView(this); cuisineIcon.setImageDrawable(getResources().getDrawable(R.drawable.cook12)); SubActionButton button3 = itemBuilder.setContentView(cuisineIcon).build(); button3.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { showMultiChoiceDialogCuisine(v); } }); ImageView favouriteIcon = new ImageView(this); favouriteIcon.setImageDrawable(getResources().getDrawable(R.drawable.favorite)); SubActionButton button4 = itemBuilder.setContentView(favouriteIcon).build(); button4.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { showSimpleListDialogFav(v); } }); ImageView wandIcon = new ImageView(this); wandIcon.setImageDrawable(getResources().getDrawable(R.drawable.wand)); SubActionButton button5 = itemBuilder.setContentView(wandIcon).build(); button5.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { sugg = getSuggestion(); suggOccurrences = getCount(); showSimpleListDialogSuggestions(v); } }); final FloatingActionButton actionABC = (FloatingActionButton) findViewById(R.id.action_abc); actionABC.bringToFront(); actionABC.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (ingredients.length() < 2) { Snackbar.make(responseView, "Insert at least one ingredient", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } else { new RetrieveFeedTask().execute(); } } // Snackbar.make(view, "Non disponibile, mangia l'aria", Snackbar.LENGTH_LONG) // .setAction("Action", null).show(); }); FloatingActionMenu actionMenu = new FloatingActionMenu.Builder(this).setStartAngle(90).setEndAngle(270) .addSubActionView(button1).addSubActionView(button2).addSubActionView(button3) .addSubActionView(button4).addSubActionView(button5).attachTo(actionButton).build(); startDatabase(chefacileDb); for (int j = 0; j < cuisineItems.length; j++) { cuisineItems[j] = cuisineItems[j].substring(0, 1).toUpperCase() + cuisineItems[j].substring(1); } Arrays.sort(cuisineItems); for (int i = 0; i < 24; i++) { cuisineBool[i] = false; } Arrays.sort(intolItems); for (int i = 0; i < 11; i++) { intolBool[i] = false; } mListView = (MaterialListView) findViewById(R.id.material_listview); adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1); TutorialButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { startActivity(new Intent(MainActivity.this, IntroScreenActivity.class)); overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); } }); iv = (ImageView) findViewById(R.id.imageView); iv.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { clicks++; Log.d("CLICKS", String.valueOf(clicks)); if (clicks == 15) { Log.d("IMAGE SHOWN", "mai vero"); setBackground(iv); } } }); materialAnimatedSwitch.setOnCheckedChangeListener(new MaterialAnimatedSwitch.OnCheckedChangeListener() { @Override public void onCheckedChanged(boolean isChecked) { if (isChecked == true) { ranking = 2; Toast.makeText(getApplicationContext(), "Minimize missing ingredients", Toast.LENGTH_SHORT) .show(); } else { ranking = 1; Toast.makeText(getApplicationContext(), "Maximize used ingredients", Toast.LENGTH_SHORT).show(); } Log.d("Ranking", String.valueOf(ranking)); } }); final CharSequence[] items = { "Maximize used ingredients", "Minimize missing ingredients" }; editText.setOnKeyListener(new View.OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_DOWN) { switch (keyCode) { case KeyEvent.KEYCODE_DPAD_CENTER: case KeyEvent.KEYCODE_ENTER: if (!(editText.getText().toString().trim().equals(""))) { String input; String s1 = editText.getText().toString().substring(0, 1).toUpperCase(); String s2 = editText.getText().toString().substring(1); input = s1 + s2; Log.d("INPUT: ", input); searchedIngredients.add(input); Log.d("SEARCHED INGR LIST", searchedIngredients.toString()); if (!chefacileDb.findIngredientPREF(input)) { if (chefacileDb.findIngredient(input)) { chefacileDb.updateCount(input); mapIngredients = chefacileDb.getDataInMapIngredient(); Map<String, Integer> map2; map2 = sortByValue(mapIngredients); Log.d("MAPPACOUNT: ", map2.toString()); } else { if (chefacileDb.occursExceeded()) { //chefacileDb.deleteMinimum(input); // chefacileDb.insertDataIngredient(input); mapIngredients = chefacileDb.getDataInMapIngredient(); Map<String, Integer> map3; map3 = sortByValue(mapIngredients); Log.d("MAPPAINGREDIENTE: ", map3.toString()); } else { chefacileDb.insertDataIngredient(input); mapIngredients = chefacileDb.getDataInMapIngredient(); Map<String, Integer> map3; map3 = sortByValue(mapIngredients); Log.d("MAPPAINGREDIENTE: ", map3.toString()); } } } } if (editText.getText().toString().trim().equals("")) { ingredients += editText.getText().toString().trim() + ""; editText.getText().clear(); } else { ingredients += editText.getText().toString().replaceAll(" ", "+").trim().toLowerCase() + ","; singleIngredient = editText.getText().toString().trim().toLowerCase(); currentIngredient = singleIngredient; new RetrieveIngredientTask().execute(); //adapter.add(singleIngredient.substring(0,1).toUpperCase() + singleIngredient.substring(1)); } InputMethodManager in = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); in.hideSoftInputFromWindow(editText.getApplicationWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); actionABC.startAnimation(animation); return true; default: break; } } return false; } }); responseView = (TextView) findViewById(R.id.responseView); editText = (EditText) findViewById(R.id.ingredientText); progressBar = (ProgressBar) findViewById(R.id.progressBar); }
From source file:com.df.app.procedures.CarRecogniseLayout.java
/** * VIN??// w w w. j av a 2 s .co m */ private void checkVinAndGetCarSettings() { InputMethodManager imm = (InputMethodManager) rootView.getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(findViewById(R.id.vin_edit).getWindowToken(), 0); final String vinString = getEditViewText(rootView, R.id.vin_edit); // ? if (vinString.equals("")) { Toast.makeText(rootView.getContext(), "VIN?", Toast.LENGTH_SHORT).show(); findViewById(R.id.vin_edit).requestFocus(); return; } // VIN? if (!isVin(vinString)) { View view1 = ((Activity) getContext()).getLayoutInflater().inflate(R.layout.popup_layout, null); TableLayout contentArea = (TableLayout) view1.findViewById(R.id.contentArea); TextView content = new TextView(view1.getContext()); content.setText("VIN?: " + vinString + "\n" + "VIN?????\n"); content.setTextSize(20f); contentArea.addView(content); setTextView(view1, R.id.title, getResources().getString(R.string.alert)); AlertDialog dialog = new AlertDialog.Builder(rootView.getContext()).setView(view1) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { setEditViewText(rootView, R.id.brand_edit, ""); findViewById(R.id.brand_select_button).setEnabled(false); // ???VIN getCarSettingsFromServer(); } }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { findViewById(R.id.vin_edit).requestFocus(); } }).create(); dialog.show(); return; } setEditViewText(rootView, R.id.brand_edit, ""); findViewById(R.id.brand_select_button).setEnabled(false); // ???VIN getCarSettingsFromServer(); }
From source file:no.ntnu.idi.socialhitchhiking.map.MapActivityCreateOrEditRoute.java
/** * Initialize the {@link AutoCompleteTextView}'s with an {@link ArrayAdapter} * and a listener ({@link AutoCompleteTextWatcher}). The listener gets autocomplete * data from the Google Places API and updates the ArrayAdapter with these. */// ww w .j a va 2s. co m private void initAutocomplete() { adapter = new ArrayAdapter<String>(this, R.layout.item_list); adapter.setNotifyOnChange(true); acFrom = (AutoCompleteTextView) findViewById(R.id.etGoingFrom); acFrom.setAdapter(adapter); acFrom.addTextChangedListener(new AutoCompleteTextWatcher(this, adapter, acFrom)); acFrom.setThreshold(1); acTo = (AutoCompleteTextView) findViewById(R.id.etGoingTo); acTo.setAdapter(adapter); acTo.addTextChangedListener(new AutoCompleteTextWatcher(this, adapter, acTo)); acTo.setOnEditorActionListener(new EditText.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); final Button button = ((Button) findViewById(R.id.btnChooseRoute)); if (actionId == EditorInfo.IME_ACTION_DONE) { if (checkFields() && selectedRoute.getMapPoints().size() > 2 && hasDrawn == true) { button.setEnabled(true); button.setText("Next"); return true; } else if (checkFields() && selectedRoute.getMapPoints().size() == 0) { mapView.getOverlays().clear(); createMap(); button.setEnabled(true); button.setText("Next"); return true; } else if (checkFields() == false && selectedRoute.getMapPoints().size() == 0) { button.setText("Show on map"); button.setEnabled(false); return false; } else { button.setText("Show on map"); button.setEnabled(false); return false; } } return false; } }); }
From source file:com.initialxy.cordova.themeablebrowser.ThemeableBrowser.java
/** * Navigate to the new page/*w w w .j a v a2 s . co m*/ * * @param url to load */ private void navigate(String url) { InputMethodManager imm = (InputMethodManager) this.cordova.getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(edittext.getWindowToken(), 0); if (!url.startsWith("http") && !url.startsWith("file:")) { this.inAppWebView.loadUrl("http://" + url); } else { this.inAppWebView.loadUrl(url); } this.inAppWebView.requestFocus(); }
From source file:fr.univsavoie.ltp.client.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Appliquer le thme LTP a l'ActionBar //setTheme(R.style.Theme_ltp); // Cration de l'activit principale setContentView(R.layout.activity_main); // Instancier les classes utiles setPopup(new Popup(this)); setSession(new Session(this)); setTools(new Tools(this)); // Afficher la ActionBar ActionBar mActionBar = getSupportActionBar(); mActionBar.setHomeButtonEnabled(true); mActionBar.setDisplayShowHomeEnabled(true); // MapView settings map = (MapView) findViewById(R.id.openmapview); map.setTileSource(TileSourceFactory.MAPNIK); map.setBuiltInZoomControls(false);//from w w w. j a va 2 s .c o m map.setMultiTouchControls(true); // MapController settings mapController = map.getController(); //To use MapEventsReceiver methods, we add a MapEventsOverlay: overlay = new MapEventsOverlay(this, this); map.getOverlays().add(overlay); boolean isWifiEnabled = false; boolean isGPSEnabled = false; // Vrifier si le wifi ou le rseau mobile est activ final ConnectivityManager connMgr = (ConnectivityManager) this .getSystemService(Context.CONNECTIVITY_SERVICE); final NetworkInfo wifi = connMgr.getNetworkInfo(ConnectivityManager.TYPE_WIFI); final NetworkInfo mobile = connMgr.getNetworkInfo(ConnectivityManager.TYPE_MOBILE); if (wifi.isAvailable() && (wifi.getDetailedState() == DetailedState.CONNECTING || wifi.getDetailedState() == DetailedState.CONNECTED)) { Toast.makeText(this, R.string.toast_wifi, Toast.LENGTH_LONG).show(); isWifiEnabled = true; } else if (mobile.isAvailable() && (mobile.getDetailedState() == DetailedState.CONNECTING || mobile.getDetailedState() == DetailedState.CONNECTED)) { Toast.makeText(this, R.string.toast_3G, Toast.LENGTH_LONG).show(); } else { Toast.makeText(this, R.string.toast_aucun_reseau, Toast.LENGTH_LONG).show(); } // Obtenir le service de localisation locationManager = (LocationManager) getSystemService(LOCATION_SERVICE); // Verifier si le service de localisation GPS est actif, le cas echeant, tester le rseau if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 30 * 1000, 250.0f, this); location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); isGPSEnabled = true; } else if (locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) { locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 30 * 1000, 250.0f, this); location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); } // Afficher une boite de dialogue et proposer d'activer un ou plusieurs services pas actifs if (!isWifiEnabled || !isGPSEnabled) { //getTools().showSettingsAlert(this, isWifiEnabled, isGPSEnabled); } // Si on a une localisation, on dfinit ses coordonnes geopoint if (location != null) { startPoint = new GeoPoint(location.getLatitude(), location.getLongitude()); } else { // Sinon, on indique des paramtres par dfaut location = getTools().getLastKnownLocation(locationManager); if (location == null) { location = new Location(""); location.setLatitude(46.227638); location.setLongitude(2.213749000000); } startPoint = new GeoPoint(46.227638, 2.213749000000); } setLongitude(location.getLongitude()); setLatitude(location.getLatitude()); destinationPoint = null; viaPoints = new ArrayList<GeoPoint>(); // On recupre quelques paramtres de la session prcdents si possible if (savedInstanceState == null) { mapController.setZoom(15); mapController.setCenter(startPoint); } else { mapController.setZoom(savedInstanceState.getInt("zoom_level")); mapController.setCenter((GeoPoint) savedInstanceState.getParcelable("map_center")); } // Crer un overlay sur la carte pour afficher notre point de dpart myLocationOverlay = new SimpleLocationOverlay(this, new DefaultResourceProxyImpl(this)); map.getOverlays().add(myLocationOverlay); myLocationOverlay.setLocation(startPoint); // Boutton pour zoomer la carte ImageButton btZoomIn = (ImageButton) findViewById(R.id.btZoomIn); btZoomIn.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { map.getController().zoomIn(); } }); // Boutton pour dezoomer la carte ImageButton btZoomOut = (ImageButton) findViewById(R.id.btZoomOut); btZoomOut.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { map.getController().zoomOut(); } }); // Pointeurs d'itinrairea: final ArrayList<ExtendedOverlayItem> waypointsItems = new ArrayList<ExtendedOverlayItem>(); itineraryMarkers = new ItemizedOverlayWithBubble<ExtendedOverlayItem>(this, waypointsItems, map, new ViaPointInfoWindow(R.layout.itinerary_bubble, map)); map.getOverlays().add(itineraryMarkers); //updateUIWithItineraryMarkers(); Button searchButton = (Button) findViewById(R.id.buttonSearch); searchButton.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { handleSearchLocationButton(); } }); //context menu for clicking on the map is registered on this button. registerForContextMenu(searchButton); // Routes et Itinraires final ArrayList<ExtendedOverlayItem> roadItems = new ArrayList<ExtendedOverlayItem>(); roadNodeMarkers = new ItemizedOverlayWithBubble<ExtendedOverlayItem>(this, roadItems, map); map.getOverlays().add(roadNodeMarkers); if (savedInstanceState != null) { mRoad = savedInstanceState.getParcelable("road"); updateUIWithRoad(mRoad); } //POIs: //POI search interface: String[] poiTags = getResources().getStringArray(R.array.poi_tags); poiTagText = (AutoCompleteTextView) findViewById(R.id.poiTag); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, poiTags); poiTagText.setAdapter(adapter); Button setPOITagButton = (Button) findViewById(R.id.buttonSetPOITag); setPOITagButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { //Hide the soft keyboard: InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(poiTagText.getWindowToken(), 0); //Start search: getPOIAsync(poiTagText.getText().toString()); } }); //POI markers: final ArrayList<ExtendedOverlayItem> poiItems = new ArrayList<ExtendedOverlayItem>(); poiMarkers = new ItemizedOverlayWithBubble<ExtendedOverlayItem>(this, poiItems, map, new POIInfoWindow(map)); map.getOverlays().add(poiMarkers); if (savedInstanceState != null) { mPOIs = savedInstanceState.getParcelableArrayList("poi"); updateUIWithPOI(mPOIs); } // Load friends ListView lvListeFriends = (ListView) findViewById(R.id.listViewFriends); //lvListeFriends.setBackgroundResource(R.drawable.listview_roundcorner_item); lvListeFriends.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> adapter, View v, int position, long id) { Friends item = (Friends) adapter.getItemAtPosition(position); if (item.getLongitude() != 0.0 && item.getLatitude() != 0.0) { destinationPoint = new GeoPoint(item.getLongitude(), item.getLatitude()); markerDestination = putMarkerItem(markerDestination, destinationPoint, DEST_INDEX, R.string.destination, R.drawable.marker_destination, -1); getRoadAsync(); map.getController().setCenter(destinationPoint); } else { Toast.makeText(MainActivity.this, R.string.toast_friend_statut, Toast.LENGTH_LONG).show(); } } }); viewMapFilters = (ScrollView) this.findViewById(R.id.scrollViewMapFilters); viewMapFilters.setVisibility(View.GONE); // Initialiser tout ce qui est donnes utilisateur propres l'activit init(); getTools().relocateUser(mapController, map, myLocationOverlay, location); }