Issue
I'm trying to get a MapView in a fragment but I don't know how. When I was researching this I saw some manipulation with the library, but it changes my extends Fragment in extends FragmentActivity and then everything gets messy!
Please help me with the code so I can have a MapView within a fragment.
Here's my code :
public class MyPlayerFrag extends Fragment{
Context context;
ImageView image;
TextView caption;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
LinearLayout player_layout = (LinearLayout) inflater.inflate(com.idouchach.casa.tramway.R.layout.player, container, false);
image = (ImageView) player_layout.findViewById(R.id.image_view);
caption = (TextView) player_layout.findViewById(R.id.caption);
return player_layout;
}
public void updateImage(Content content){
if(image != null){
try{
Bitmap img = BitmapFactory.decodeStream(context.getAssets().open(content.getImg()));
image.setImageBitmap(img);
image.invalidate();
}catch(Exception ex){
ex.printStackTrace();
}
}
if(caption != null)
caption.setText(content.getTitle());
}
}
Solution
There is no officially supported means of putting a MapView into a fragment, sorry.
Answered By - CommonsWare
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.