I first display map with markers on it (defaulting to markers
associated with the current date). User can then use datepicker to
enter another date, and then they submit it like a form. Then new
markers are displayed based on the date selected. The process of
querying the dates I handle on the web server, not on the android. I
just send the data back to the android so that the phone can then show
markers. The part I am stuck is not the querying part. It's the part
of how do I show a datepicker with the map. So that the user can
select a date within the context of the map. This is what I have so
far:


show_history.xml

<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android";
  android:id="@+id/history_map"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  class="com.google.android.gms.maps.MapFragment"/>

date_picker.xml

<?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:orientation="vertical" >

<Button android:id="@+id/myDatePickerButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Choose Date"/>
<TextView android:id="@+id/showMyDate"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"/>
</LinearLayout>

showhistoryactivity.java

public class ShowHistoryActivity extends Activity {

        MapView mapView;
        String authkey, unit_id;
        SharedPreferences preferences;
        private GoogleMap mMap;
        final Handler myHandler = new Handler();
        protected List<Map<String, String>> historyData;

        private int mYear;
        private int mMonth;
        private int mDay;

        private Button mPickDate;
        private TextView mDateDisplay;

        static final int DATE_DIALOG_ID = 0;


        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
                setContentView(R.layout.show_history);
                Intent intent=getIntent();
                unit=intent.getStringExtra("unit");
                preferences=PreferenceManager.getDefaultSharedPreferences(this);
                authkey=preferences.getString(AndroidRemoteContants.auth_token,
"NULL");

            mDateDisplay = (TextView) findViewById(R.id.showMyDate);
                mPickDate = (Button) findViewById(R.id.myDatePickerButton);

                System.out.println("value stored: " + mDateDisplay);

                mPickDate.setOnClickListener(new View.OnClickListener() {
                public void onClick(View v) {
                    showDialog(DATE_DIALOG_ID);
                }
            });

                 final Calendar c = Calendar.getInstance();
                 mYear = c.get(Calendar.YEAR);
                 mMonth = c.get(Calendar.MONTH);
                 mDay = c.get(Calendar.DAY_OF_MONTH);

                 updateDisplay();

                 setUpMapIfNeeded();
        }

It already falls apart at this point because mDateDisplay is null.

Essentially, I am not sure how to display a datepicker in the same
screen as the map and have the two of them interact.


On Jan 15, 6:01 pm, TreKing <[email protected]> wrote:
> On Tue, Jan 15, 2013 at 4:15 PM, John Merlino <[email protected]> wrote:
> > Now I would for the user on the same screen to activate a datepicker and
> > select a date, then press enter, so then I cna query databsse and show new
> > markers accordingly.
> > What would be the best approach to do this?
>
> Do what? You outlined at least 5 concrete actions. Be more specific. Also,
> what have you tried so far? Where exactly are you stuck?
>
> --------------------------------------------------------------------------- 
> ----------------------
> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to