1. Download our Official Android App: Forums for Android!

Apps Google Maps Android

Discussion in 'Android Development' started by Gonzo, Aug 9, 2013.

  1. Gonzo

    Gonzo Newbie
    Thread Starter
    Rank:
    None
    Points:
    36
    Posts:
    11
    Joined:
    Aug 3, 2013

    Aug 3, 2013
    11
    1
    36
    I am trying to put a Marker of a special location, I have tried all the marking ways but cannot figure it out...here is my code

    import com.google.android.gms.maps.SupportMapFragment;

    import android.os.Bundle;
    import android.support.v4.app.Fragment;
    import android.support.v4.app.FragmentActivity;
    import android.support.v4.app.FragmentManager;
    import android.support.v4.app.FragmentTransaction;

    public class Contacts3 extends FragmentActivity {
    private static final String Contacts3 = "Contacts3";

    @Override
    protected void onCreate(Bundle arg0) {
    super.onCreate(arg0);
    setContentView(R.layout.contacts3);

    }

    @Override
    protected void onResume() {
    super.onResume();

    SupportMapFragment mMapFragment = SupportMapFragment.newInstance();
    FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
    fragmentTransaction.add(R.id.contacts3map, mMapFragment, Contacts3);
    fragmentTransaction.commitAllowingStateLoss();

    }

    @Override
    protected void onPause() {

    super.onPause();


    FragmentManager fmanager = getSupportFragmentManager();

    Fragment fragment = fmanager.findFragmentByTag(Contacts3);
    fmanager.beginTransaction().remove(fragment).commitAllowingStateLoss();


    }


    }

    Here is my layout...the map works i just need a marker

    <?xml version="1.0" encoding="utf-8"?>


    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:eek:rientation="vertical"
    android:id="@+id/contacts3map"
    >


    </LinearLayout>
     

    Advertisement

  2. Granite1

    Granite1 Zercron Encrusted Tweezer
    Rank:
    None
    Points:
    833
    Posts:
    7,148
    Joined:
    Dec 27, 2010

    Dec 27, 2010
    7,148
    7,173
    833
    Male
    Highway Construction Inspection
    Pittsburgh, PA
    Are you trying to Alter the code in Google Maps?

    Or are you developing something new?

    I moved the thread over to the development forum, hope you don't mind.

    I think you'll get better help with your question in our development forum. The other experienced devs can give you better assistance. :)
     
  3. Gonzo

    Gonzo Newbie
    Thread Starter
    Rank:
    None
    Points:
    36
    Posts:
    11
    Joined:
    Aug 3, 2013

    Aug 3, 2013
    11
    1
    36
    Thank you! I did not see where to put this type of question..sorry for putting it in the general area.

    I am trying to have two tabs have two different maps and two different markers for two different locations. This makes each tab have its own map but I cannot get a marker to work.
     
    Granite1 likes this.
  4. Granite1

    Granite1 Zercron Encrusted Tweezer
    Rank:
    None
    Points:
    833
    Posts:
    7,148
    Joined:
    Dec 27, 2010

    Dec 27, 2010
    7,148
    7,173
    833
    Male
    Highway Construction Inspection
    Pittsburgh, PA
    Ahhh, ok. I'm not much of a dev myself, so I'm not much help with the code. :eek:

    Also no worries about where you posted your thread, that's why we're here. :)

    If you have any questions shoot me a PM, my door is always open. :)
     
  5. Gonzo

    Gonzo Newbie
    Thread Starter
    Rank:
    None
    Points:
    36
    Posts:
    11
    Joined:
    Aug 3, 2013

    Aug 3, 2013
    11
    1
    36
    Thank you!
     
  6. out of ideas

    out of ideas Android Enthusiast
    Rank:
    None
    Points:
    93
    Posts:
    640
    Joined:
    May 19, 2012

    May 19, 2012
    640
    145
    93
    in the future put your code into [ code] tags (without the space) to be easier to read. are those your mainactivity and activity_main.xml?

    That code has nothing about a marker, so of course you dont have one showing up. what did you try?

    EDIT: and why isnt is setup as a fragment, that code works like that? whats your other xml?
     

Share This Page

Loading...