Example usage for android.widget TextView setOnClickListener

List of usage examples for android.widget TextView setOnClickListener

Introduction

In this page you can find the example usage for android.widget TextView setOnClickListener.

Prototype

public void setOnClickListener(@Nullable OnClickListener l) 

Source Link

Document

Register a callback to be invoked when this view is clicked.

Usage

From source file:com.zpwebsites.linuxonandroid.opensource.BaseActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setTitle(mTitleRes);/*from ww  w. j av  a 2s  .  c o m*/

    // set the Behind View
    setBehindContentView(R.layout.menu_frame);

    // customize the SlidingMenu
    SlidingMenu sm = getSlidingMenu();
    sm.setShadowWidthRes(R.dimen.shadow_width);
    sm.setShadowDrawable(R.drawable.shadow);
    //sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
    sm.setBehindWidth(400);
    sm.setFadeDegree(0.35f);
    sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    TextView txt_Installview = (TextView) findViewById(R.id.Installtxtview);
    txt_Installview.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Intent intent = new Intent(v.getContext(), Install_Guides.class);
            v.getContext().startActivity(intent);
        }

    });
    TextView txt_Launchtxtview = (TextView) findViewById(R.id.Launchtxtview);
    txt_Launchtxtview.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Intent intent = new Intent(v.getContext(), Launcher.class);
            v.getContext().startActivity(intent);
        }

    });
    TextView txt_Tipstxtview = (TextView) findViewById(R.id.Tipstxtview);
    txt_Tipstxtview.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Intent intent = new Intent(v.getContext(), Tips.class);
            v.getContext().startActivity(intent);
        }

    });
    TextView txt_FAQtxtview = (TextView) findViewById(R.id.FAQtxtview);
    txt_FAQtxtview.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Intent intent = new Intent(v.getContext(), FAQ.class);
            v.getContext().startActivity(intent);
        }

    });
    TextView txt_Changelogtxtview = (TextView) findViewById(R.id.Changelogtxtview);
    txt_Changelogtxtview.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Intent intent = new Intent(v.getContext(), Change_logs.class);
            v.getContext().startActivity(intent);
        }

    });
    TextView txt_Newstxtview = (TextView) findViewById(R.id.Newstxtview);
    txt_Newstxtview.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Intent intent = new Intent(v.getContext(), News.class);
            v.getContext().startActivity(intent);
        }

    });
    TextView txt_Aboutstxtview = (TextView) findViewById(R.id.Aboutstxtview);
    txt_Aboutstxtview.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Intent intent = new Intent(v.getContext(), About.class);
            v.getContext().startActivity(intent);
        }

    });
}

From source file:com.chess.genesis.view.SwipeTabsPagerAdapter.java

@Override
public TextView getTab(final int position, final SwipeTabs root) {
    final TextView view = (TextView) LayoutInflater.from(mContext).inflate(R.layout.swipetab_indicator, root,
            false);//from w  ww .  jav a2  s.  co  m
    view.setText(TITLES[position]);
    view.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(final View v) {
            mViewPager.setCurrentItem(position);
        }
    });
    return view;
}

From source file:com.eleybourn.bookcatalogue.goodreads.GoodreadsRegister.java

public void setupViews() {
    final Resources res = this.getResources();
    /* GR Reg Link */
    TextView register = (TextView) findViewById(R.id.goodreads_url);
    register.setOnClickListener(new OnClickListener() {
        @Override/* www .  j  a va2  s .co m*/
        public void onClick(View v) {
            String url = res.getString(R.string.goodreads_url);
            Uri uri = Uri.parse(url);
            Intent loadweb = new Intent(Intent.ACTION_VIEW, uri);
            startActivity(loadweb);
            return;
        }
    });

    /* Auth button */
    Button devkeyLink = (Button) findViewById(R.id.authorize);
    devkeyLink.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            requestAuthorizationInBackground(GoodreadsRegister.this);
            return;
        }
    });

    /* Forget credentials */
    boolean hasCred = GoodreadsManager.hasCredentials();
    View blurb = findViewById(R.id.forget_blurb);
    Button blurb_button = (Button) findViewById(R.id.forget);
    if (hasCred) {
        blurb.setVisibility(View.VISIBLE);
        blurb_button.setVisibility(View.VISIBLE);
        blurb_button.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                GoodreadsManager.forgetCredentials();
            }
        });
    } else {
        blurb.setVisibility(View.GONE);
        blurb_button.setVisibility(View.GONE);
    }
}

From source file:com.Social.Movement3.About.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle saBundle) {
    View rootView = inflater.inflate(R.layout.about, container, false);
    //      getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    TextView GoogleLegalNotices = (TextView) rootView.findViewById(R.id.textView12);
    //      googleservice.setText(GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(getActivity()));
    GoogleLegalNotices.setOnClickListener(new OnClickListener() {

        @Override//from www. j  a  va2s.com
        public void onClick(View v) {
            // TODO Auto-generated method stub
            //DO you work here
            AlertDialog.Builder alert = new AlertDialog.Builder(getActivity());

            alert.setTitle("Google Legal Notices");
            alert.setNegativeButton("OK", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int id) {
                    FlurryAgent.logEvent("Live Note OK");
                }
            });

            Dialog d = alert.setMessage(GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(getActivity()))
                    .create();
            d.show();
        }
    });

    FragmentActivity ab = getActivity(); //needs  import android.app.ActionBar;
    ab.setTitle("So Appreciated");
    Log.d("DEBUG", GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(getActivity()));

    return rootView;

}

From source file:com.ankit.touchreview.LoginActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.login);/*  ww w  . j av  a 2  s.  c  o m*/

    mContext = this;
    mProcessing = new ProgressDialog(mContext);
    mProcessing.setCancelable(true);
    mProcessing.setMessage("Please Wait");
    mProcessing.setTitle("Logging in");
    mProcessing.setOnCancelListener(new OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialog) {
            if (logging_in) {
                Intent i = new Intent(LoginActivity.this, HomeActivity.class);
                startActivity(i);
                finish();
            }
        }
    });

    username = (TextView) findViewById(R.id.username);
    password = (TextView) findViewById(R.id.password);

    String token = Utility.getUserPrefernce(mContext, "token");
    if (token != null && !"".equals(token)) {
        Intent i = new Intent(LoginActivity.this, HomeActivity.class);
        startActivity(i);
        finish();
    }

    TextView thanking_text = (TextView) findViewById(R.id.thanking_text);
    thanking_text.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://touchtoreview.com/thankyou"));
            startActivity(myIntent);
        }
    });
}

From source file:com.zpwebsites.linuxonandroid.BaseActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setTitle(mTitleRes);/*from ww w .  j a  v  a2s.  c o  m*/

    // set the Behind View
    setBehindContentView(R.layout.menu_frame);

    // customize the SlidingMenu
    SlidingMenu sm = getSlidingMenu();
    sm.setShadowWidthRes(R.dimen.shadow_width);
    sm.setShadowDrawable(R.drawable.shadow);
    // sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
    DisplayMetrics displaymetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
    int width = displaymetrics.widthPixels;

    if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
        // code to do for Portrait Mode
        sm.setBehindWidth((int) (width * 0.7));
    } else {
        // code to do for Landscape Mode
        sm.setBehindWidth((int) (width * 0.25));
    }
    sm.setFadeDegree(0.35f);
    sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    TextView txt_Installview = (TextView) findViewById(R.id.Installtxtview);
    txt_Installview.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Intent intent = new Intent(v.getContext(), Install_Guides.class);
            v.getContext().startActivity(intent);
        }

    });
    TextView txt_Launchtxtview = (TextView) findViewById(R.id.Launchtxtview);
    txt_Launchtxtview.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Intent intent = new Intent(v.getContext(), Launcher.class);
            v.getContext().startActivity(intent);
        }

    });
    TextView txt_Tipstxtview = (TextView) findViewById(R.id.Tipstxtview);
    txt_Tipstxtview.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Intent intent = new Intent(v.getContext(), Tips.class);
            v.getContext().startActivity(intent);
        }

    });
    TextView txt_FAQtxtview = (TextView) findViewById(R.id.FAQtxtview);
    txt_FAQtxtview.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Intent intent = new Intent(v.getContext(), FAQ.class);
            v.getContext().startActivity(intent);
        }

    });
    TextView txt_Changelogtxtview = (TextView) findViewById(R.id.Changelogtxtview);
    txt_Changelogtxtview.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Intent intent = new Intent(v.getContext(), Change_logs.class);
            v.getContext().startActivity(intent);
        }

    });
    TextView txt_Newstxtview = (TextView) findViewById(R.id.Newstxtview);
    txt_Newstxtview.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Intent intent = new Intent(v.getContext(), News.class);
            v.getContext().startActivity(intent);
        }

    });
    TextView txt_Aboutstxtview = (TextView) findViewById(R.id.Aboutstxtview);
    txt_Aboutstxtview.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Intent intent = new Intent(v.getContext(), About.class);
            v.getContext().startActivity(intent);
        }

    });

}

From source file:ca.liquidlabs.android.speedtestvisualizer.activities.AboutAppActivity.java

/**
 * Initializes / Attaches Event Listeners to Buttons
 *///from w w  w.  j a  va2 s.com
private void initListeners() {
    Button btn = (Button) super.findViewById(R.id.btn_license_info);
    final AboutAppActivity $this = AboutAppActivity.this;

    btn.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub

            new AlertDialog.Builder($this).setTitle($this.getString(R.string.lbl_license_info))
                    .setMessage(GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo($this))
                    .setNegativeButton("OK", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int whichButton) {
                            // Do nothing.
                        }
                    }).show();
        }
    });

    btn = (Button) super.findViewById(R.id.btn_google_play_apps);
    btn.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            String googlePlayLink = $this.getString(R.string.google_play_query);
            $this.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(googlePlayLink)));
        }
    });

    /* On Tap of the TextView, simply redirect user to the Github Repo */
    TextView txtView = (TextView) super.findViewById(R.id.txt_about_info);
    txtView.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent browserIntent = new Intent(Intent.ACTION_VIEW,
                    Uri.parse($this.getString(R.string.github_url)));
            $this.startActivity(browserIntent);
        }
    });

    txtView = (TextView) super.findViewById(R.id.txt_author_info);
    txtView.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent browserIntent = new Intent(Intent.ACTION_VIEW,
                    Uri.parse($this.getString(R.string.author_url)));
            $this.startActivity(browserIntent);
        }
    });
}

From source file:com.zpwebsites.linuxonandroid.ListBaseActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setTitle(mTitleRes);//from w  w  w. j  a v  a2  s  . co m

    // set the Behind View
    setBehindContentView(R.layout.menu_frame);

    // customize the SlidingMenu
    SlidingMenu sm = getSlidingMenu();
    sm.setShadowWidthRes(R.dimen.shadow_width);
    sm.setShadowDrawable(R.drawable.shadow);
    //sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
    DisplayMetrics displaymetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
    int width = displaymetrics.widthPixels;

    if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
        // code to do for Portrait Mode
        sm.setBehindWidth((int) (width * 0.7));
    } else {
        // code to do for Landscape Mode  
        sm.setBehindWidth((int) (width * 0.25));
    }
    sm.setFadeDegree(0.35f);
    sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    TextView txt_Installview = (TextView) findViewById(R.id.Installtxtview);
    txt_Installview.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Intent intent = new Intent(v.getContext(), Install_Guides.class);
            v.getContext().startActivity(intent);
        }

    });
    TextView txt_Launchtxtview = (TextView) findViewById(R.id.Launchtxtview);
    txt_Launchtxtview.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Intent intent = new Intent(v.getContext(), Launcher.class);
            v.getContext().startActivity(intent);
        }

    });
    TextView txt_Tipstxtview = (TextView) findViewById(R.id.Tipstxtview);
    txt_Tipstxtview.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Intent intent = new Intent(v.getContext(), Tips.class);
            v.getContext().startActivity(intent);
        }

    });
    TextView txt_FAQtxtview = (TextView) findViewById(R.id.FAQtxtview);
    txt_FAQtxtview.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Intent intent = new Intent(v.getContext(), FAQ.class);
            v.getContext().startActivity(intent);
        }

    });
    TextView txt_Changelogtxtview = (TextView) findViewById(R.id.Changelogtxtview);
    txt_Changelogtxtview.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Intent intent = new Intent(v.getContext(), Change_logs.class);
            v.getContext().startActivity(intent);
        }

    });
    TextView txt_Newstxtview = (TextView) findViewById(R.id.Newstxtview);
    txt_Newstxtview.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Intent intent = new Intent(v.getContext(), News.class);
            v.getContext().startActivity(intent);
        }

    });
    TextView txt_Aboutstxtview = (TextView) findViewById(R.id.Aboutstxtview);
    txt_Aboutstxtview.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Intent intent = new Intent(v.getContext(), About.class);
            v.getContext().startActivity(intent);
        }

    });
}

From source file:cw.kop.autobackground.tutorial.CardFragment.java

@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {

    final View view = AppSettings.getTheme().equals(AppSettings.APP_LIGHT_THEME)
            ? inflater.inflate(R.layout.tutorial_card_fragment, container, false)
            : inflater.inflate(R.layout.tutorial_card_fragment_dark, container, false);
    View sourceCard = view.findViewById(R.id.source_card);
    sourceCard.setOnClickListener(this);

    int colorFilterInt = AppSettings.getColorFilterInt(appContext);

    TextView sourceTitle = (TextView) view.findViewById(R.id.source_title);
    sourceTitle.setOnClickListener(new View.OnClickListener() {
        @Override/*w  w w .  j  a  va 2s.  c o  m*/
        public void onClick(View v) {
            CardFragment.this.onClick(view);
        }
    });

    ImageView deleteButton = (ImageView) view.findViewById(R.id.source_delete_button);
    ImageView viewButton = (ImageView) view.findViewById(R.id.source_view_image_button);
    ImageView editButton = (ImageView) view.findViewById(R.id.source_edit_button);

    Drawable deleteDrawable = getResources().getDrawable(R.drawable.ic_delete_white_24dp);
    Drawable viewDrawable = getResources().getDrawable(R.drawable.ic_photo_white_24dp);
    Drawable editDrawable = getResources().getDrawable(R.drawable.ic_edit_white_24dp);

    deleteDrawable.setColorFilter(colorFilterInt, PorterDuff.Mode.MULTIPLY);
    viewDrawable.setColorFilter(colorFilterInt, PorterDuff.Mode.MULTIPLY);
    editDrawable.setColorFilter(colorFilterInt, PorterDuff.Mode.MULTIPLY);

    deleteButton.setImageDrawable(deleteDrawable);
    viewButton.setImageDrawable(viewDrawable);
    editButton.setImageDrawable(editDrawable);

    deleteButton.setOnClickListener(null);
    viewButton.setOnClickListener(null);
    editButton.setOnClickListener(null);

    TextView sourceType = (TextView) view.findViewById(R.id.source_type);
    TextView sourceData = (TextView) view.findViewById(R.id.source_data);
    TextView sourceNum = (TextView) view.findViewById(R.id.source_num);
    TextView sourceTime = (TextView) view.findViewById(R.id.source_time);

    int colorPrimary = getResources().getColor(R.color.BLUE_OPAQUE);
    SpannableString typePrefix = new SpannableString("Type: ");
    typePrefix.setSpan(new ForegroundColorSpan(colorPrimary), 0, typePrefix.length(),
            Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    SpannableString dataPrefix = new SpannableString("Data: ");
    dataPrefix.setSpan(new ForegroundColorSpan(colorPrimary), 0, dataPrefix.length(),
            Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    SpannableString numPrefix = new SpannableString("Number of Images: ");
    numPrefix.setSpan(new ForegroundColorSpan(colorPrimary), 0, numPrefix.length(),
            Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    SpannableString timePrefix = new SpannableString("Active Time: ");
    timePrefix.setSpan(new ForegroundColorSpan(colorPrimary), 0, timePrefix.length(),
            Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

    sourceType.setText(typePrefix);
    sourceData.setText(dataPrefix);
    sourceNum.setText(numPrefix);
    sourceTime.setText(timePrefix);

    ImageView image = (ImageView) view.findViewById(R.id.source_image);
    Picasso.with(appContext).load(R.drawable.preview_image_0).fit().centerCrop().into(image);

    TextView titleText = (TextView) view.findViewById(R.id.title_text);
    titleText.setTextColor(colorFilterInt);
    titleText.setText("Sources");

    TextView tutorialText = (TextView) view.findViewById(R.id.tutorial_text);
    tutorialText.setTextColor(colorFilterInt);
    tutorialText.setText("These are the parts that make up your wallpaper. "
            + "Each represents an image source like an album from Imgur or "
            + "a subreddit. Note that not all websites or entries can work " + "with AutoBackground.");

    return view;
}

From source file:com.enadein.carlogbook.ui.AboutFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    TextView linkSrc = (TextView) view.findViewById(R.id.link_src);
    linkSrc.setOnClickListener(new View.OnClickListener() {
        @Override//from w  w  w.  j av a  2  s . c  om
        public void onClick(View view) {
            openUrl(getString(R.string.open_src_url));
        }
    });

    view.findViewById(R.id.lib1).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            openUrl(getString(R.string.lib1_val_url));
        }
    });

    view.findViewById(R.id.link_ask).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            sendEmail(getString(R.string.email_subject_ask));
        }
    });

    view.findViewById(R.id.link_provide).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            sendEmail(getString(R.string.email_subject_provide));
        }
    });

    view.findViewById(R.id.lic).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            getMediator().showLic();
        }
    });

    view.findViewById(R.id.link_rate).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            rateApp();
        }
    });
    view.findViewById(R.id.don1).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            donate(CarLogbook.PRODUCT_1, AboutFragment.this);
        }
    });
    view.findViewById(R.id.don2).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            donate(CarLogbook.PRODUCT_2, AboutFragment.this);
        }
    });

    view.findViewById(R.id.don3).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            donate(CarLogbook.PRODUCT_3, AboutFragment.this);
        }
    });

    TextView versionView = (TextView) view.findViewById(R.id.ver);
    versionView.setText(versionView.getText() + ": " + CarLogbook.VERSION);
}