2016-08-01 2 views
0

Можно ли добавить имя пользователя в TextView внутри информационного окна google?Нужно добавить имя пользователя синтаксиса в infowindow

В следующем коде я могу получить заголовок, описание и изображение из синтаксического анализа, я хочу добавить текущего пользователя в текстовое окно, но я не смог. То, что я ищу это немного руководства, поскольку там Арент много сообщений относительно этого (Или, возможно, мне нужно идти в глубокую сеть) Ее мой код для справки

@Override 
    public void onMapReady(final GoogleMap googleMap) { 
     googleMap.setMyLocationEnabled(true); 
     this.googleMap = googleMap; 
     googleMap.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() { 

      // Use default InfoWindow frame 
      @Override 
      public View getInfoWindow(Marker arg0) { 
       return null; 
      } 

      // Defines the contents of the InfoWindow 
      @Override 
      public View getInfoContents(Marker marker) { 

       // Getting view from the layout file info_window_layout 
       View v = getActivity().getLayoutInflater().inflate(R.layout.maps_infowindow, null); 
       v.setLayoutParams(new LinearLayout.LayoutParams((int) (mapFragment.getView().getMeasuredWidth() * .9), LinearLayout.LayoutParams.WRAP_CONTENT)); 

       ((TextView) v.findViewById(R.id.title)).setText(marker.getTitle()); 
       ((TextView) v.findViewById(R.id.desc)).setText(marker.getSnippet()); 
       ((TextView) v.findViewById(R.id.user)).setText((CharSequence) ParseUser.getCurrentUser()); // PROBLEM HERE 



       Item item = mMarker2Item.get(marker); 
       if(item.iconBitmap==null){ 
        //this is a blocking call, it will run until download complete 
        item.downloadIcon(getActivity()); 
       } 

       ImageView icon = (ImageView) v.findViewById(R.id.imageView5); 
       icon.getLayoutParams().height = 800; // OR 
       icon.getLayoutParams().width = 800; 

       if(item.iconBitmap!=null){ 
        icon.setImageBitmap(item.iconBitmap); 
       }else{ 
       } 

       return v; 

      } 

     }); 

ответ

0

Ааа Ok легкий материал. Все, что мне нужно было сделать, это заставить пользователя String разобраться и установить его в текстовый файл следующим образом:

String user = ParseUser.getCurrentUser().getString("username"); 
       ((TextView) v.findViewById(R.id.user)).setText(user); 
Смежные вопросы