开发者

android mapview traffic info

I try to display traffic informations on a mapview but nothing is shown while it works perfectly with the native Maps application (for the same location).

Here's my code:

public class Main extends MapActivity 
{
    private MapView map = null;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    LinearLayout ll = new LinearLayout(this);
    ll.setOrientation(LinearLayout.VERTICAL);

    map = new MapView(this,"XXXX");
    map.setEnabled(true);
    map.setClickable(true);
    map.setBuiltInZoomControls(true);
    map.setTraffic(true);

    ll.addView(map, new LinearLayout.LayoutParams(
     开发者_开发百科   LayoutParams.FILL_PARENT,
        LayoutParams.FILL_PARENT));
    setContentView(ll);  
}


You must be in a region that doesn't have many traffic information. Try browsing in the US and see if you see some traffic info there ?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜