Android Open Source - android-wearcamera Camera Fragment

From Project

Back to project page android-wearcamera.


The source code is released under:

GNU General Public License

If you think the Android project android-wearcamera listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package net.dheera.wearcamera;
// w  ww . j ava  2  s . c o  m
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

public class CameraFragment extends Fragment {
    private View.OnClickListener mOnClickListener;

    public ImageView cameraPreview = null;
    public ImageView cameraResult;
    public TextView cameraTime;

    public ImageView mImageView_tip;

    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View contentView = inflater.inflate(, container, false);
        cameraPreview = (ImageView)contentView.findViewById(;
        cameraTime = (TextView)contentView.findViewById(;
        cameraResult = (ImageView)contentView.findViewById(;

        SharedPreferences preferences = getActivity().getPreferences(0);
        if (preferences.getBoolean("tip0_hide", false) == false) {
            mImageView_tip = (ImageView) contentView.findViewById(;
            mImageView_tip.setOnClickListener(new View.OnClickListener() {
                public void onClick(View v) {
                    SharedPreferences preferences = getActivity().getPreferences(0);
                    SharedPreferences.Editor editor = preferences.edit();
                    editor.putBoolean("tip0_hide", true);

        return contentView;

    public void setOnClickListener(View.OnClickListener listener) {
        mOnClickListener = listener;

Java Source Code List