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.RSMSA.policeApp.Dialogues.PaymentConfirmationDialogue.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
    getDialog().setCanceledOnTouchOutside(false);

    RelativeLayout relativeLayout = (RelativeLayout) inflater.inflate(R.layout.dialogue_payment_confirmation,
            container, false);/* www.  j  av  a2 s  .  c  o  m*/

    TextView costTextView = (TextView) relativeLayout.findViewById(R.id.place);
    costTextView.setText(cost + "");

    TextView nameTextView = (TextView) relativeLayout.findViewById(R.id.name);
    nameTextView.setText(name);

    TextView licenceNumberTextView = (TextView) relativeLayout.findViewById(R.id.licence_number);
    licenceNumberTextView.setText(offence.getDriver_license_number() + "");

    TextView plate_numberTextView = (TextView) relativeLayout.findViewById(R.id.plate_number);
    plate_numberTextView.setText(offence.getVehicle_plate_number());

    final String[] paymentMethodsArray = this.getResources().getStringArray(R.array.payment_methods);
    Spinner paymentMethodSpinner = (Spinner) relativeLayout.findViewById(R.id.payment_method_spinner);
    PaymentMethodSpinnerAdapter adapter = new PaymentMethodSpinnerAdapter(getActivity(), R.layout.row_menu,
            paymentMethodsArray);
    paymentMethodSpinner.setAdapter(adapter);
    paymentMethodSpinner.setBackground(null);
    paymentMethodSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            paymentMethod = paymentMethodsArray[position];
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {

        }
    });
    receiptEditText = (EditText) relativeLayout.findViewById(R.id.receipt);

    TextView okButton = (TextView) relativeLayout.findViewById(R.id.ok_button);
    okButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (receiptEditText.getText().toString().equals("")) {
                receiptEditText.setHintTextColor(Color.RED);
            } else {
                new ProcessRegister().execute();
            }
        }
    });

    TextView cancelButton = (TextView) relativeLayout.findViewById(R.id.cancel_button);
    cancelButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            //mListener.onComplete(false, index);
            dismiss();
        }
    });

    return relativeLayout;
}

From source file:com.autoparts.buyers.activity.UserInfoActivity.java

private void initPhotoDialog() {
    photoDialog = DialogUtil.createDialog(this, R.layout.photo_select_dialog, R.style.CustomDialog);
    photoDialog.setCancelable(true);// w  w  w  .j  a  va2  s .  c o m
    TextView photo_dialog_title = (TextView) photoDialog.findViewById(R.id.regist_dialog_title);
    TextView photo_camera = (TextView) photoDialog.findViewById(R.id.photo_camera);
    TextView photo_gallery = (TextView) photoDialog.findViewById(R.id.photo_gallery);
    photo_camera.setOnClickListener(this);
    photo_gallery.setOnClickListener(this);

    DialogUtil.setDialogParams(this, photoDialog, R.dimen.dialog_width_margin);
}

From source file:com.buddi.client.dfu.FeaturesActivity.java

private void setupPluginsInDrawer(final ViewGroup container) {
    final LayoutInflater inflater = LayoutInflater.from(this);
    final PackageManager pm = getPackageManager();

    // look for Master Control Panel
    final Intent mcpIntent = new Intent(Intent.ACTION_MAIN);
    mcpIntent.setClassName(MCP_PACKAGE, MCP_CLASS);
    final ResolveInfo mcpInfo = pm.resolveActivity(mcpIntent, 0);

    // configure link to Master Control Panel
    final TextView mcpItem = (TextView) container.findViewById(R.id.link_mcp);
    if (mcpInfo == null) {
        mcpItem.setTextColor(Color.GRAY);
        ColorMatrix grayscale = new ColorMatrix();
        grayscale.setSaturation(0.0f);//  w w  w .  j  av a 2  s  .  co m
        mcpItem.getCompoundDrawables()[0].setColorFilter(new ColorMatrixColorFilter(grayscale));
    }
    mcpItem.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(final View v) {
            Intent action = mcpIntent;
            if (mcpInfo == null)
                action = new Intent(Intent.ACTION_VIEW, Uri.parse(MCP_MARKET_URI));
            action.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
            try {
                startActivity(action);
            } catch (final ActivityNotFoundException e) {
                Toast.makeText(FeaturesActivity.this, R.string.no_application_play, Toast.LENGTH_SHORT).show();
            }
            mDrawerLayout.closeDrawers();
        }
    });

    // look for other plug-ins
    final Intent utilsIntent = new Intent(Intent.ACTION_MAIN);
    utilsIntent.addCategory(UTILS_CATEGORY);

    final List<ResolveInfo> appList = pm.queryIntentActivities(utilsIntent, 0);
    for (final ResolveInfo info : appList) {
        final View item = inflater.inflate(R.layout.drawer_plugin, container, false);
        final ImageView icon = (ImageView) item.findViewById(android.R.id.icon);
        final TextView label = (TextView) item.findViewById(android.R.id.text1);

        label.setText(info.loadLabel(pm));
        icon.setImageDrawable(info.loadIcon(pm));
        item.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(final View v) {
                final Intent intent = new Intent();
                intent.setComponent(new ComponentName(info.activityInfo.packageName, info.activityInfo.name));
                intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
                startActivity(intent);
                mDrawerLayout.closeDrawers();
            }
        });
        container.addView(item);
    }
}

From source file:com.money.manager.ex.about.AboutFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    String text, version;/*  w  ww.  ja v  a  2s. com*/
    View view = inflater.inflate(R.layout.about_fragment, container, false);

    MmxBaseFragmentActivity activity = (MmxBaseFragmentActivity) getActivity();
    if (activity != null && activity.getSupportActionBar() != null) {
        activity.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }

    // Version application
    TextView txtVersion = (TextView) view.findViewById(R.id.textViewVersion);
    Core core = new Core(getActivity());
    version = core.getAppVersionName();
    //        build = core.getAppVersionBuild();
    txtVersion.setText(getString(R.string.version) + " " + version);
    // + " (" + getString(R.string.build) + " " + build + ")"

    // Send Feedback
    TextView txtFeedback = (TextView) view.findViewById(R.id.textViewLinkFeedback);
    text = "<u>" + txtFeedback.getText() + "</u>";
    txtFeedback.setText(Html.fromHtml(text));
    txtFeedback.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(Intent.ACTION_SEND);
            intent.setType("message/rfc822");
            intent.putExtra(Intent.EXTRA_EMAIL, new String[] { Constants.EMAIL });
            intent.putExtra(Intent.EXTRA_SUBJECT, "MoneyManagerEx for Android: Feedback");
            try {
                startActivity(Intent.createChooser(intent, "Send mail..."));
            } catch (Exception e) {
                Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
            }
        }
    });

    // rate application
    TextView txtRate = (TextView) view.findViewById(R.id.textViewLinkRate);
    text = "<u>" + txtRate.getText() + "</u>";
    txtRate.setText(Html.fromHtml(text));
    txtRate.setMovementMethod(LinkMovementMethod.getInstance());
    OnClickListenerUrl clickListenerRate = new OnClickListenerUrl();
    clickListenerRate.setUrl("http://play.google.com/store/apps/details?id=com.money.manager.ex");
    txtRate.setOnClickListener(clickListenerRate);

    // application issue tracker
    TextView txtIssues = (TextView) view.findViewById(R.id.textViewIssuesTracker);
    text = "<u>" + txtIssues.getText() + "</u>";
    txtIssues.setText(Html.fromHtml(text));
    txtIssues.setMovementMethod(LinkMovementMethod.getInstance());
    OnClickListenerUrl clickListenerIssuesTracker = new OnClickListenerUrl();
    clickListenerIssuesTracker.setUrl("https://github.com/moneymanagerex/android-money-manager-ex/issues/");
    txtIssues.setOnClickListener(clickListenerIssuesTracker);

    // MMEX for Android web page
    TextView txtWebsite = (TextView) view.findViewById(R.id.textViewWebSite);
    text = "<u>" + txtWebsite.getText() + "</u>";
    txtWebsite.setText(Html.fromHtml(text));
    txtWebsite.setMovementMethod(LinkMovementMethod.getInstance());
    OnClickListenerUrl clickListenerWebsite = new OnClickListenerUrl();
    clickListenerWebsite.setUrl("http://android.moneymanagerex.org/");
    txtWebsite.setOnClickListener(clickListenerWebsite);

    // report set link
    TextView txtReport = (TextView) view.findViewById(R.id.textViewLinkWebSite);
    text = "<u>" + txtReport.getText() + "</u>";
    txtReport.setText(Html.fromHtml(text));
    txtReport.setMovementMethod(LinkMovementMethod.getInstance());
    OnClickListenerUrl clickListenerFeedback = new OnClickListenerUrl();
    clickListenerFeedback
            .setUrl("http://www.moneymanagerex.org/?utm_campaign=Application_Android&utm_medium=MMEX_" + version
                    + "&utm_source=Website");
    txtReport.setOnClickListener(clickListenerFeedback);

    // image view google plus
    OnClickListenerUrl clickListenerGooglePlus = new OnClickListenerUrl();
    clickListenerGooglePlus.setUrl("http://goo.gl/R693Ih");
    ImageView imageViewGooglePlus = (ImageView) view.findViewById(R.id.imageViewGooglePlus);
    imageViewGooglePlus.setOnClickListener(clickListenerGooglePlus);

    // image view github
    OnClickListenerUrl clickListenerGithub = new OnClickListenerUrl();
    clickListenerGithub.setUrl("https://github.com/moneymanagerex/android-money-manager-ex");
    ImageView imageViewGithub = (ImageView) view.findViewById(R.id.imageViewGithub);
    imageViewGithub.setOnClickListener(clickListenerGithub);
    // image view twitter
    OnClickListenerUrl clickListenerTwitter = new OnClickListenerUrl();
    clickListenerTwitter.setUrl("https://twitter.com/MMEX4Android");
    ImageView imageViewTwitter = (ImageView) view.findViewById(R.id.imageViewTwitter);
    imageViewTwitter.setOnClickListener(clickListenerTwitter);
    // GPLv2 license
    TextView txtLicense = (TextView) view.findViewById(R.id.textViewLicense);
    text = "<u>" + txtLicense.getText() + "</u>";
    txtLicense.setText(Html.fromHtml(text));
    OnClickListenerUrl clickListenerLicense = new OnClickListenerUrl();
    clickListenerLicense.setUrl("http://www.gnu.org/licenses/old-licenses/gpl-2.0.html");
    txtLicense.setOnClickListener(clickListenerLicense);
    // logcat
    TextView txtLogcat = (TextView) view.findViewById(R.id.textViewLogcat);
    text = "<u>" + txtLogcat.getText() + "</u>";
    txtLogcat.setText(Html.fromHtml(text));
    txtLogcat.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            LynxConfig lynxConfig = new LynxConfig();
            lynxConfig.setMaxNumberOfTracesToShow(4000);

            Intent lynxActivityIntent = LynxActivity.getIntent(getActivity(), lynxConfig);
            startActivity(lynxActivityIntent);
        }
    });

    // Donate, button
    Button buttonDonate = (Button) view.findViewById(R.id.buttonDonateInApp);
    buttonDonate.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            startActivity(new Intent(getActivity(), DonateActivity.class));
        }
    });

    // Send logcat button
    Button sendLogcatButton = (Button) view.findViewById(R.id.sendLogcatButton);
    sendLogcatButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            sendLogcat();
        }
    });
    return view;
}

From source file:com.imalu.alyou.activity.FriendlistFragment.java

private void showListView() {
    adapter = new FriendAdapter(getActivity(), R.layout.row_contact, R.layout.row_contact2,
            AlUApplication.getFriends().getFriendList(), sidebar);
    listView.setAdapter(adapter);/*  ww  w.j a va2s.  c o m*/
    listView.setOnItemClickListener(new OnItemClickListener() {
        //
        //         @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            String username = adapter.getItem(position).getUsername();
            if (Constant.NEW_FRIENDS_USERNAME.equals(username)) {
                // ?
                HXUser user = AlUApplication.getInstance().getContactList().get(Constant.NEW_FRIENDS_USERNAME);
                user.setUnreadMsgCount(0);
                startActivity(new Intent(getActivity(), NewFriendsMsgActivity.class));
            } else if (Constant.GROUP_USERNAME.equals(username)) {
                // ??
                startActivity(new Intent(getActivity(), GroupsActivity.class));
            } else {
                // demo??
                startActivity(new Intent(getActivity(), ChatActivity.class).putExtra("userId",
                        adapter.getItem(position).getHxname()));
            }
        }
    });

    listView.setOnTouchListener(new OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            // ??
            if (getActivity().getWindow()
                    .getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
                if (getActivity().getCurrentFocus() != null)
                    inputMethodManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(),
                            InputMethodManager.HIDE_NOT_ALWAYS);
            }
            return false;
        }
    });
    //
    TextView addContactView = (TextView) getView().findViewById(R.id.add_friend);
    //      // ?
    addContactView.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            startActivity(new Intent(getActivity(), AddContactActivity.class));
        }
    });
    registerForContextMenu(listView);
}

From source file:com.example.cake.mqtttest.registerActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_register);

    Button bt_regis = (Button) findViewById(R.id.bt_cancel);
    bt_regis.setOnClickListener(new View.OnClickListener() {
        @Override// w  ww.ja v a  2  s .  c  o  m
        public void onClick(View view) {

            Intent i_regis = new Intent(getApplicationContext(), MainActivity.class);
            startActivity(i_regis);
        }
    });

    TextView cImage = (TextView) findViewById(R.id.choose_image_from);
    cImage.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {

            Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
            photoPickerIntent.setType("image/*");
            startActivityForResult(photoPickerIntent, SELECT_PHOTO);
        }
    });

    Eid = (EditText) findViewById(R.id.edit_id);
    EfirstName = (EditText) findViewById(R.id.edit_first_name);
    ElastName = (EditText) findViewById(R.id.edit_lastname);
    Eemail = (EditText) findViewById(R.id.edit_email);
    EphoneNumber = (EditText) findViewById(R.id.edit_mobile_number);
    Epassword = (EditText) findViewById(R.id.edit_pass);
    // EidNumber = (EditText) findViewById(R.id.edit_id);
    EcarModel = (EditText) findViewById(R.id.edit_car_model);
    ElicensePlateNumber = (EditText) findViewById(R.id.edit_license_plate);

    Button bt_reg = (Button) findViewById(R.id.bt_regis);
    bt_reg.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {

            String[] ll = new String[9];
            ll[0] = "id" + Eid.getText().toString();
            ll[1] = EfirstName.getText().toString();
            ll[2] = ElastName.getText().toString();
            ll[3] = Eemail.getText().toString();
            ll[4] = EphoneNumber.getText().toString();
            ll[5] = Epassword.getText().toString();
            ll[6] = Eid.getText().toString();
            ll[7] = EcarModel.getText().toString();
            ll[8] = ElicensePlateNumber.getText().toString();

            if (!ll[0].isEmpty() && !ll[1].isEmpty() && !ll[2].isEmpty() && !ll[3].isEmpty() && !ll[4].isEmpty()
                    && !ll[5].isEmpty() && !ll[6].isEmpty() && !ll[7].isEmpty() && !ll[8].isEmpty()) {
                sendRegisterRequest loginRequest = new sendRegisterRequest();
                loginRequest.delegate = registerActivity.this;
                loginRequest.execute(ll);

                String filename = Eid.getText().toString() + ".png";
                String[] lll = { filename, encoded };
                sendImageRequest imRequest = new sendImageRequest();
                imRequest.delegate = registerActivity.this;
                imRequest.execute(lll);

            } else {
                new AlertDialog.Builder(registerActivity.this).setCancelable(false).setTitle("Incomplete data")
                        .setMessage("Please fill all the fields.")
                        .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {

                            }
                        }).show();

            }

        }
    });

}

From source file:com.yahala.ui.LoginActivitySmsView.java

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

    confirmTextView = (TextView) findViewById(R.id.login_sms_confirm_text);
    codeField = (EditText) findViewById(R.id.login_sms_code_field);
    codeField.setHint(LocaleController.getString("Code", R.string.Code));
    timeText = (TextView) findViewById(R.id.login_time_text);
    TextView wrongNumber = (TextView) findViewById(R.id.wrong_number);
    wrongNumber.setText(LocaleController.getString("WrongNumber", R.string.WrongNumber));

    wrongNumber.setOnClickListener(new OnClickListener() {
        @Override/*from  w w  w . ja  v a  2s .  c om*/
        public void onClick(View view) {
            onBackPressed();
            delegate.setPage(0, true, null, true);
        }
    });

    codeField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
            if (i == EditorInfo.IME_ACTION_NEXT) {
                if (delegate != null) {
                    delegate.onNextAction();
                }
                return true;
            }
            return false;
        }
    });
}

From source file:com.autoparts.sellers.activity.SellerUserInfoActivity.java

private void initPhotoDialog() {
    photoDialog = DialogUtil.createDialog(this, R.layout.photo_select_dialog, R.style.CustomDialog);
    photoDialog.setCancelable(true);//from   www  . ja  v  a2s.  c om
    TextView photo_dialog_title = (TextView) photoDialog.findViewById(R.id.regist_dialog_title);
    TextView photo_camera = (TextView) photoDialog.findViewById(R.id.photo_camera);
    TextView photo_gallery = (TextView) photoDialog.findViewById(R.id.photo_gallery);
    photo_camera.setOnClickListener(this);
    photo_gallery.setOnClickListener(this);
    DialogUtil.setDialogParams(this, photoDialog, R.dimen.dialog_width_margin);
}

From source file:com.ymt.demo1.plates.exportConsult.ExportConsultMainActivity.java

protected void initView() {
    TextView moreExpert = (TextView) findViewById(R.id.more_export);
    moreExpert.setOnClickListener(this);
    TextView dutyTime = (TextView) findViewById(R.id.nearly_export);
    String str = dutyTime.getText().toString();
    dutyTime.setText(str + "(" + getDay() + ")");
    initTodTomExport();//from   w ww . j av  a 2  s. c  om
    initNearlyHotConsult();
    initOnDutyExpertView();
}

From source file:com.github.jobs.ui.fragment.JobDetailsFragment.java

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

    Bundle arguments = getArguments();/*w ww  .  j a v  a 2  s. com*/
    String jobId = arguments.getString(KEY_JOB_ID);
    mJob = new Job();
    mJob.setId(jobId);
    mJob = adapter.findFirst(mJob);
    if (mJob == null) {
        mJob = new Job();
        Toast.makeText(getActivity(), R.string.error_getting_job_info, Toast.LENGTH_LONG).show();
    }
    setHasOptionsMenu(true);

    TextView title = (TextView) getView().findViewById(R.id.title);
    title.setText(StringUtils.trim(mJob.getTitle()));

    TextView description = (TextView) getView().findViewById(R.id.description);
    String jobDescription = mJob.getDescription();
    if (jobDescription != null) {
        description.setText(Html.fromHtml(jobDescription));
        description.setMovementMethod(LinkMovementMethod.getInstance());
    }

    TextView company = (TextView) getView().findViewById(R.id.company);
    company.setText(mJob.getCompany());

    TextView companyUrl = (TextView) getView().findViewById(R.id.company_url);
    if (mJob.getCompanyUrl() == null) {
        companyUrl.setVisibility(View.GONE);
    } else {
        SpannableString content = new SpannableString(mJob.getCompanyUrl());
        content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
        companyUrl.setText(content);
        companyUrl.setOnClickListener(this);
        companyUrl.setVisibility(View.VISIBLE);
    }

    TextView companyLocation = (TextView) getView().findViewById(R.id.company_location);
    if (mJob.getLocation() == null) {
        companyLocation.setVisibility(View.GONE);
    } else {
        companyLocation.setText(mJob.getLocation());
        companyLocation.setVisibility(View.VISIBLE);
    }

    if (!JobDetailsActivity.FULL_TIME.equalsIgnoreCase(mJob.getType())) {
        getView().findViewById(R.id.full_time).setVisibility(View.INVISIBLE);
    }

    mBackground = (ImageView) getView().findViewById(R.id.job_details_background);
    setLogoBackground();
}