mardi 4 novembre 2014

MapFragment automatically redirect to another fragemnt


Vote count:

0




I my application i have used fragment, in one fragment i have loaded details fragment as well as map fragment, in map fragment having two edittext, whenever i click edittext it automatically redirect to details fragment


here is my xml



<LinearLayout xmlns:android="http://ift.tt/nIICcg"
xmlns:tools="http://ift.tt/LrGmb4"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >

<EditText
android:id="@+id/pickupBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:inputType="textPersonName" >
</EditText>

<Button
android:id="@+id/pickup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Route" />

<EditText
android:id="@+id/destinationBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:inputType="textPersonName" />

<Button
android:id="@+id/destination"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Pickup" />
</LinearLayout>

<com.google.android.gms.maps.MapView
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent" />

</LinearLayout>


My Activity



@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
listFragmentView = inflater.inflate(R.layout.map_activity, container,
false);
mapView = (MapView) listFragmentView.findViewById(R.id.map);
mapView.onCreate(savedInstanceState);

if (mapView != null) {
map = mapView.getMap();
}

mPickUPAddress = (EditText) listFragmentView
.findViewById(R.id.pickupBox);
mPickupRoute = (Button) listFragmentView.findViewById(R.id.pickup);

mDestination = (EditText) listFragmentView
.findViewById(R.id.destinationBox);
mDestinationRoute = (Button) listFragmentView
.findViewById(R.id.destination);
// To initialize the map
MapsInitializer.initialize(getActivity());
// To start an alarm service
startAlarm(getActivity().getApplicationContext());

mGPSTRACKER = new GPSTracker(getActivity());

if (mGPSTRACKER.canGetLocation()) {
mSourceLatitude = mGPSTRACKER.getLatitude();
mSourceLongitude = mGPSTRACKER.getLongitude();

Toast.makeText(getActivity(), String.valueOf(mSourceLatitude),
Toast.LENGTH_LONG).show();
}
}


Please give some idea to get solution



asked 55 secs ago







MapFragment automatically redirect to another fragemnt

Aucun commentaire:

Enregistrer un commentaire