小编moh*_*aza的帖子

从android中的地址获取经度和经度

我试图从地址获得纬度和经度,问题是...当我只提供城市名称而不是给我正确的纬度和经度,当我给出完整的地址(如州,城市名称,街道号)比它不给我正确的纬度和经度......

谢谢你的合作回应......

我的代码是......

//String addressStr = "faisalabad";/// this give me correct address
        String addressStr = "Sainta Augustine,FL,4405 Avenue A";
          Geocoder geoCoder = new Geocoder(MapClass.this, Locale.getDefault());

          try {
              List<Address> addresses =
          geoCoder.getFromLocationName(addressStr, 1); 
              if (addresses.size() >  0) {
                 latitude = addresses.get(0).getLatitude(); longtitude =
          addresses.get(0).getLongitude(); }

          } catch (IOException e) { // TODO Auto-generated catch block
          e.printStackTrace(); }


        pos = new LatLng(latitude, longtitude);
        googleMap.addMarker(new MarkerOptions().icon(
                BitmapDescriptorFactory
                        .defaultMarker(BitmapDescriptorFactory.HUE_RED))
                .position(pos));
        googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(pos, 15));
        googleMap.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null);
Run Code Online (Sandbox Code Playgroud)

android geocoding android-maps android-maps-v2

11
推荐指数
1
解决办法
1万
查看次数

在android中启动游戏

我有PAC MAN游戏代码如何在Android中将此游戏称为活动..我想在Android应用程序中调用在线游戏,而不是如何在链接上调用Android应用程序中的在线游戏,如果用户点击该特定游戏链接,比游戏午餐形式网上网...像PAC MAN这样的游戏.谢谢

public class Board extends JPanel implements ActionListener {

    Dimension d;
    Font smallfont = new Font("Helvetica", Font.BOLD, 14);

    FontMetrics fmsmall, fmlarge;
    Image ii;
    Color dotcolor = new Color(192, 192, 0);
    Color mazecolor;

    boolean ingame = false;
    boolean dying = false;

    final int blocksize = 24;
    final int nrofblocks = 15;
    final int scrsize = nrofblocks * blocksize;
    final int pacanimdelay = 2;
    final int pacmananimcount = 4;
    final int maxghosts = 12;
    final int pacmanspeed = 6;

    int …
Run Code Online (Sandbox Code Playgroud)

android

7
推荐指数
1
解决办法
230
查看次数

如何在XML选择器中使用字体图标(font-awesome)

是否可以在选择器中使用字体图标而不是drawable?

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
    <item android:drawable="@drawable/menu_home_press" android:state_pressed="true"></item>
    <item android:drawable="@drawable/menu_home"></item>
</selector>
Run Code Online (Sandbox Code Playgroud)

xml android font-awesome

6
推荐指数
1
解决办法
4372
查看次数

Google地图在地图中不显示任何内容

我正在活动中显示地图......但是当我在设备上运行应用程序时它没有显示任何内容,它只显示白屏并放大缩小选项... MAP键是正确的...谢谢..

AndroidManifest.xml中

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.edxample.finalmap"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />



     <permission android:name="com.edxample.finalmap.permission.MAPS_RECEIVE"
         android:protectionLevel="signature" />
     <uses-permission android:name="com.edxample.finalmap.permission.MAPS_RECEIVE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

    <uses-feature android:glEsVersion="0x00020000"
        android:required="true" />




    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.edxample.finalmap.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="AIzaSyBL8ANi3jKkM0tF65C_Qus2_JgWRzClhfU" />

    </application>

</manifest>
Run Code Online (Sandbox Code Playgroud)

activity_main.xml中

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >

     <fragment
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        xmlns:map="http://schemas.andoid.com/apk/es-auto" …
Run Code Online (Sandbox Code Playgroud)

android android-maps android-mapview

4
推荐指数
2
解决办法
7974
查看次数