2016-08-01 4 views
0

Googleマップのinfowindow内のTextViewにユーザー名を追加することはできますか?infowindowに解析ユーザー名を追加する必要があります

次のコードでは、パーズからタイトル、説明、イメージを取得できますが、現在のユーザーをテキストビューに追加したいが、私はできませんでした。そこにこのに関しては、多くの記事をアレント(または多分私は深いウェブに行く必要がある)ので、私は何を探していますと、指導のビットである彼女の[OK]を簡単にスタッフああ参照

@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

ための私のコードです。私がしなければならなかったのは、ユーザーストリングを解析して、次のようにテキストビューに設定することでした:

String user = ParseUser.getCurrentUser().getString("username"); 
       ((TextView) v.findViewById(R.id.user)).setText(user); 
関連する問題