View setOnClickListener - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for View setOnClickListener method.

This code example shows how to use the following methods:setContentDescription, setOnClickListener, setVisibility, setText
 
    public void resetRotateDialog() { 
        inflateDialogLayout(); 
        mRotateDialogTitleLayout.setVisibility(View.GONE);
        mRotateDialogSpinner.setVisibility(View.GONE);
        mRotateDialogButton1.setVisibility(View.GONE);
        mRotateDialogButton2.setVisibility(View.GONE);
        mRotateDialogButtonLayout.setVisibility(View.GONE);
    } 
 
    private void fadeOutDialog() { 
        mDialogRootLayout.startAnimation(mFadeOutAnim);
        mDialogRootLayout.setVisibility(View.GONE);
    } 
 
    private void fadeInDialog() { 
        mDialogRootLayout.startAnimation(mFadeInAnim);
        mDialogRootLayout.setVisibility(View.VISIBLE);
    } 
 

8
CodeRank
This code example shows how to use the following methods:setOnClickListener, setTag, setText
                                             LayoutParams.FILL_PARENT,
                                             1.0f); 
    } 
 
    public void addButton(String aText, int aCallback) {
        Button mButton = new Button(mContext);
        mButton.setText(aText);
        mButton.setTag(Integer.toString(aCallback));
        mButton.setOnClickListener(this);
        mChoicesLayout.addView(mButton, mLayoutParams);
    } 
 
    public void onClick(View v) {
        GeckoEvent e = GeckoEvent.createBroadcastEvent("Doorhanger:Reply", v.getTag().toString());
        GeckoAppShell.sendEventToGecko(e);
        mTab.removeDoorHanger(mValue);
 
        // This will hide the doorhanger (and hide the popup if there are no 
        // more doorhangers to show) 
        GeckoApp.mDoorHangerPopup.updatePopup(); 
8
CodeRank
This code example shows how to use the following methods:setOnClickListener
	 * @see AbstractViewFactory.create. 
	 */ 
	@Override 
	public Widget create(Activity activity, final int handle)
	{ 
		ImageButton b = new ImageButton( activity );
		b.setOnClickListener( new MoSyncSendOnClick( handle ) );
 
		return new ImageButtonWidget( handle, b );
	} 
} 
7
CodeRank
This code example shows how to use the following methods:setOnClickListener, setText
    public static final int[] HORIZONTAL_ALIGNMENTS = { LEFT, CENTER, RIGHT, FILL };
    public static final String[] VERTICAL_NAMES = { "TOP", "CENTER", "BASELINE", "BOTTOM", "FILL" };
    public static final int[] VERTICAL_ALIGNMENTS = { TOP, CENTER, NO_GRAVITY, BOTTOM, FILL };
 
    public View create(Context context, String name, int size) {
        Button result = new Button(context);
        result.setText(name);
        result.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                animate(v);
            } 
        }); 
        return result;
    } 
 
    public abstract ViewGroup create(Context context);
    public abstract String tag();
 
    public void animate(View v) {
        long start = System.currentTimeMillis();
7
CodeRank
This code example shows how to use the following methods:setOnClickListener, setText
showDialog(DIALOG_WITHOUT_EDITTEXT);
            } 
        }); 
 
        mButton2 = new Button(this);
        mButton2.setText("Dialog WITH EditText");//(R.string.open_dialog_nonscrollable);
        mButton2.setOnClickListener(new View.OnClickListener() 
        { 
            public void onClick(View v) 
            { 
                showDialog(DIALOG_WITH_EDITTEXT);
            } 
        }); 
 
        mEditText = new EditText(this);
        mLayout.addView(mEditText);
        mLayout.addView(mButton1);
        mLayout.addView(mButton2);
 
7
CodeRank
This code example shows how to use the following methods:setOnClickListener, setText
 
        Thread requestThread = new Thread(this);
        requestThread.setDaemon(true);
        requestThread.start();
 
        button = new Button(this);
        button.setText("GO");
        button.setOnClickListener(this);
 
        setContentView(button);
    } 
     
    @Override 
    protected void onStop() { 
        super.onStop(); 
 
        synchronized (this) {
            running = false;
        } 
    } 
7
CodeRank
This code example shows how to use the following methods:setOnClickListener, setVisibility
			return; 
 
		// Execution of original processing 
		if (mOnSetViewListener != null) {
			// nothing to do if return is true 
			if (mOnSetViewListener.onSetView(view, context, cursor, index))
				return; 
		} 
 
		// execution of processing OnClick 
		if (mOnClickListener != null) {
			view.setOnClickListener(mOnClickListener);
		} 
 
		if (mType == TYPE_TEXT) {
 
			if (!(view instanceof TextView))
				return; 
			String value = cursor.getString(index);
			((TextView) view).setText(value);

7
CodeRank
This code example shows how to use the following methods:setSurfaceTextureListener, setOnClickListener
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
 
        mContent = new FrameLayout(this);
 
        mTextureView = new TextureView(this);
        mTextureView.setSurfaceTextureListener(this);
        mTextureView.setOnClickListener(new View.OnClickListener() {
            @Override 
            public void onClick(View v) {
                Bitmap b = mTextureView.getBitmap(800, 800);
                BufferedOutputStream out = null;
                try { 
                    File dump = new File(Environment.getExternalStorageDirectory(), "out.png");
                    out = new BufferedOutputStream(new FileOutputStream(dump));
                    b.compress(Bitmap.CompressFormat.PNG, 100, out);
                } catch (FileNotFoundException e) {
                    e.printStackTrace();
                } finally { 
                    if (out != null) try {
7
CodeRank
This code example shows how to use the following methods:setId, setOnClickListener, setPadding, addView
		super(context, attrs, defStyle);
	} 
 
	@Override 
	protected View onCreateView(final ViewGroup parent) {		
		final RelativeLayout layout = new RelativeLayout(getContext());
		layout.setPadding(15, 5, 15, 5);
 
		 
		 
		//setup title 
		final RelativeLayout.LayoutParams titleparams = new RelativeLayout.LayoutParams(
				RelativeLayout.LayoutParams.WRAP_CONTENT,
				RelativeLayout.LayoutParams.WRAP_CONTENT);
		titleparams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
		titleparams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
 
		final TextView title = new TextView(getContext());
		title.setText(getTitle());
		title.setTextSize(24);

7
CodeRank
This code example shows how to use the following methods:setOnClickListener, setImageResource
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
                WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
         
        RelativeLayout container = new RelativeLayout(this);
         
        ImageButton button = new ImageButton(this);
        button.setImageResource(getIntent().getIntExtra("moodimg", 0));
        button.setOnClickListener(this);
         
        RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
                RelativeLayout.LayoutParams.WRAP_CONTENT,
                RelativeLayout.LayoutParams.WRAP_CONTENT);
        lp.addRule(RelativeLayout.CENTER_IN_PARENT);
         
        container.addView(button, lp);
         
        setContentView(container);
    } 
 
    public void onClick(View v) {
7
CodeRank

Related View setOnClickListener Questions & Answers:

Other View setOnClickListener Examples

40:	        
41:	        // Listening to News Feed button click
42:	        btn_newsfeed.setOnClickListener(new View.OnClickListener() {
43:				
44:				@Override
-
51:	        
52:	       // Listening Friends button click
53:	        btn_friends.setOnClickListener(new View.OnClickListener() {
54:				
55:				@Override
-
62:	        
63:	        // Listening Messages button click
64:	        btn_messages.setOnClickListener(new View.OnClickListener() {
65:				
66:				@Override
-
73:	        
74:	        // Listening to Places button click
75:	        btn_places.setOnClickListener(new View.OnClickListener() {
76:				
77:				@Override
-
84:	        
85:	        // Listening to Events button click
86:	        btn_events.setOnClickListener(new View.OnClickListener() {
87:				
88:				@Override
-
95:	        
96:	        // Listening to Photos button click
97:	        btn_photos.setOnClickListener(new View.OnClickListener() {
98:				
99:				@Override

Read More

29:			 * Check Internet status button click event
30:			 * */
31:			btnStatus.setOnClickListener(new View.OnClickListener() {
32:	
33:				@Override

Read More

53:	
54:			// Add new category click event
55:			btnAddNewCategory.setOnClickListener(new View.OnClickListener() {
56:	
57:				@Override

Read More

3:	        ...
4:	        Button button = (Button)findViewById(R.id.corky);
5:	        button.setOnClickListener(this);
6:	    }
7:

Read More

11:	    Button button = (Button)findViewById(R.id.corky);
12:	    // Register the onClick listener with the implementation above
13:	    button.setOnClickListener(mCorkyListener);
14:	    ...
15:	}

Read More

setOnClickListener Method Overview
Register a callback to be invoked when this view is clicked.
See Code Examples for other Android View Methods: