Example usage for android.widget ImageView setOnClickListener

List of usage examples for android.widget ImageView setOnClickListener

Introduction

In this page you can find the example usage for android.widget ImageView 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.sim2dial.dialer.setup.WizardConfirmFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.setup_wizard_confirm, container, false);

    username = getArguments().getString("Username");

    ImageView checkAccount = (ImageView) view.findViewById(R.id.setup_check);
    checkAccount.setOnClickListener(new OnClickListener() {
        @Override//from   ww w .  j a  v  a2s .c  o m
        public void onClick(View v) {
            isAccountVerified(username);
        }
    });

    return view;
}

From source file:at.wada811.dayscounter.view.activity.TutorialActivity.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override/*from  ww w . j a  va  2s  . c  o m*/
protected void onCreate(Bundle savedInstanceState) {
    // catch UncaughtException
    Thread.setDefaultUncaughtExceptionHandler(new CrashExceptionHandler(getApplicationContext()));
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_tutorial);
    // Window size dialog
    WindowManager.LayoutParams params = getWindow().getAttributes();
    params.width = WindowManager.LayoutParams.MATCH_PARENT;
    params.height = WindowManager.LayoutParams.MATCH_PARENT;
    getWindow().setAttributes(params);
    // Title
    setTitle(getString(R.string.app_name) + " " + ApplicationUtils.getVersionName(this));
    // check Crash report
    File file = ResourceUtils.getFile(this, CrashExceptionHandler.FILE_NAME);
    if (file.exists()) {
        startActivity(new Intent(this, CrashReportActivity.class));
        finish();
        return;
    }
    // Tutorial
    ImageView how2use = (ImageView) findViewById(R.id.how2use);
    how2use.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = IntentUtils.createOpenBrowserIntent(getString(R.string.YouTubeURL));
            startActivity(intent);
        }
    });
    Button reportProblem = (Button) findViewById(R.id.reportProblem);
    reportProblem.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            reportProblem();
        }
    });
    Button rateThisApp = (Button) findViewById(R.id.rateThisApp);
    rateThisApp.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            rateThisApp();
        }
    });
}

From source file:fm.smart.r1.ItemActivity.java

static void setSound(ImageView sound_icon, final String sound_url, final Context context, final int type_id,
        final String artifact_id, final String to_record) {
    if (!TextUtils.isEmpty(sound_url)) {
        OnClickListener sound_listener = new OnClickListener() {
            public void onClick(View v) {// TODO removed temporarily
                MediaUtility.playSound(sound_url, ItemListActivity.mMediaPlayer, context);
            }/*  w w w.  j  av  a2 s .c  o  m*/
        };
        sound_icon.setOnClickListener(sound_listener);
        sound_icon
                .setImageBitmap(BitmapFactory.decodeResource(context.getResources(), R.drawable.active_sound));
    } else {
        if (type_id == R.id.response_sound || type_id == R.id.translation_sound) {
            sound_icon.setVisibility(View.INVISIBLE);
        } else {
            sound_icon.setImageBitmap(
                    BitmapFactory.decodeResource(context.getResources(), R.drawable.inactive_sound_add));

            OnClickListener listener = new OnClickListener() {
                public void onClick(View v) {
                    // TODO removed temporarily
                    Intent intent = new Intent(Intent.ACTION_VIEW);
                    intent.setClassName(context, CreateSoundActivity.class.getName());
                    AndroidUtils.putExtra(intent, "item_id", (String) item.getId());
                    AndroidUtils.putExtra(intent, "to_record", to_record);
                    AndroidUtils.putExtra(intent, "id", artifact_id);
                    AndroidUtils.putExtra(intent, "sound_type", Integer.toString(type_id));
                    context.startActivity(intent);

                }
            };
            sound_icon.setOnClickListener(listener);
        }
    }
}

From source file:com.acrylicgoat.houstonbicyclemuseum.fragment.LandingFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ImageView iv = (ImageView) view.findViewById(R.id.landingImage1);
    iv.setImageResource(R.drawable.launch1);
    iv.setClickable(true);/*  www . j a  va  2s  .  co  m*/
    iv.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            //open about us
            Intent aboutIntent = new Intent(getActivity().getApplicationContext(), AboutUsActivity.class);
            aboutIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            startActivity(aboutIntent);
        }
    });
    ImageView iv2 = (ImageView) view.findViewById(R.id.landingImage2);
    iv2.setImageResource(R.drawable.launch2);
    iv2.setClickable(true);
    iv2.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            //open gallery
            Intent mainIntent = new Intent(getActivity().getApplicationContext(), ViewPagerActivity.class);
            mainIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            startActivity(mainIntent);

        }
    });

}

From source file:com.jacr.instagramtrendreader.MainFragment.java

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

    ViewGroup view = (ViewGroup) inflater.inflate(R.layout.frg_main, container, false);

    ImageView imv = (ImageView) view.findViewById(R.id.upperImg);
    imv.setImageURI(Uri.fromFile(new File(imagePath)));
    imv.setOnClickListener(new OnClickListener() {

        @Override/*w w w.ja v a2 s . c o m*/
        public void onClick(View v) {
            Bundle b = new Bundle();
            b.putInt(Main.ACTION_IMAGE_CLICK, key);
            Util.sendBroadcast(getActivity(), Main.ACTION_IMAGE_CLICK, b);

        }

    });

    return view;

}

From source file:com.feathercoin.wallet.feathercoin.util.BitmapFragment.java

@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    final Bitmap bitmap = (Bitmap) getArguments().getParcelable(KEY_BITMAP);

    final Dialog dialog = new Dialog(activity);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.bitmap_dialog);
    dialog.setCanceledOnTouchOutside(true);

    final ImageView imageView = (ImageView) dialog.findViewById(R.id.bitmap_dialog_image);
    imageView.setImageBitmap(bitmap);//w  ww .  j a  va  2  s . co m
    imageView.setOnClickListener(new View.OnClickListener() {
        public void onClick(final View v) {
            dismiss();
        }
    });

    return dialog;
}

From source file:cc.mintcoin.wallet.util.BitmapFragment.java

@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    final Bitmap bitmap = (Bitmap) getArguments().getParcelable(KEY_BITMAP);

    final Dialog dialog = new Dialog(activity);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.bitmap_dialog);
    dialog.setCanceledOnTouchOutside(true);

    final ImageView imageView = (ImageView) dialog.findViewById(R.id.bitmap_dialog_image);
    imageView.setImageBitmap(bitmap);/*from www. j a  va  2s .  c  o  m*/
    imageView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(final View v) {
            dismiss();
        }
    });

    return dialog;
}

From source file:com.bushstar.kobocoin_android_wallet.util.BitmapFragment.java

@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    final Bitmap bitmap = getArguments().getParcelable(KEY_BITMAP);

    final Dialog dialog = new Dialog(activity);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.bitmap_dialog);
    dialog.setCanceledOnTouchOutside(true);

    final ImageView imageView = (ImageView) dialog.findViewById(R.id.bitmap_dialog_image);
    imageView.setImageBitmap(bitmap);//  ww w  . j  a va 2  s . c om
    imageView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(final View v) {
            dismiss();
        }
    });

    return dialog;
}

From source file:com.liferay.alerts.activity.ComposeActivity.java

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

    setContentView(R.layout.compose);//  w ww  .  j a  v a2 s  .  co  m

    _edit = (EditText) findViewById(R.id.edit);

    ImageView post = (ImageView) findViewById(R.id.post);
    post.setOnClickListener(this);

    setBackListener();

    User user = AlertFactory.getZeno(this);
    ImageView portrait = (ImageView) findViewById(R.id.portrait);
    TextView userName = (TextView) findViewById(R.id.user_name);
    PortraitUtil.setUserDetails(this, user, portrait, userName);

    showKeyboard();
}

From source file:de.schildbach.wallet.ui.BitmapFragment.java

@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    final Bundle args = getArguments();
    final BitmapDrawable bitmap = new BitmapDrawable(getResources(), (Bitmap) args.getParcelable(KEY_BITMAP));
    bitmap.setFilterBitmap(false);/*from w  w  w . java  2 s .  c o  m*/

    final Dialog dialog = new Dialog(activity);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.bitmap_dialog);
    dialog.setCanceledOnTouchOutside(true);

    final ImageView imageView = (ImageView) dialog.findViewById(R.id.bitmap_dialog_image);
    imageView.setImageDrawable(bitmap);
    imageView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(final View v) {
            dismissAllowingStateLoss();
        }
    });

    return dialog;
}