Java tutorial
/* * * (C) 2014 xiao70 <196245957@qq.com> * * * GNU * GNU * GNU * <http://www.gnu.org/licenses/>. * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ package com.sinelead.car.club.map; import com.sinelead.car.club.R; import com.sinelead.car.club.R.layout; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.TextView; public class NaviMainFragmentBottom extends Fragment { private View view; public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { view = inflater.inflate(R.layout.fragment_map_bottom, container, false); init(); return view; } void init() { // View navView = view.findViewById(R.id.layout_nav); navView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // activity Intent intent = new Intent(getActivity(), PositionSearchActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(intent); return; } }); } }