當前位置: 首頁>>代碼示例>>Java>>正文


Java ToggleButton.setOnCheckedChangeListener方法代碼示例

本文整理匯總了Java中android.widget.ToggleButton.setOnCheckedChangeListener方法的典型用法代碼示例。如果您正苦於以下問題:Java ToggleButton.setOnCheckedChangeListener方法的具體用法?Java ToggleButton.setOnCheckedChangeListener怎麽用?Java ToggleButton.setOnCheckedChangeListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.ToggleButton的用法示例。


在下文中一共展示了ToggleButton.setOnCheckedChangeListener方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: init

import android.widget.ToggleButton; //導入方法依賴的package包/類
public void init() {
    recyclerView = (RecyclerView) findViewById(R.id.student_recyclerview);
    btnSearch = (ToggleButton)findViewById(R.id.btn_search_student);
    btnSearchOk = (Button)findViewById(R.id.btn_search_ok_student);
    btnBack = (Button) findViewById(R.id.btn_back_student);
    editTextSearch =(EditText)findViewById(R.id.etxt_search_student);
    frameLayoutSearch = (FrameLayout)findViewById(R.id.frame_search_student);
    txtMsgContent = (TextView) findViewById(R.id.message_label_stud);

    frameLayoutSearch.setVisibility(View.GONE);
    txtMsgContent.setVisibility(View.INVISIBLE);

    btnSearch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked)
                frameLayoutSearch.setVisibility(View.VISIBLE);
            else
                frameLayoutSearch.setVisibility(View.GONE);
        }
    });
}
 
開發者ID:inteliedoit,項目名稱:thesis-project,代碼行數:22,代碼來源:StudentViewActivity.java

示例2: StudentAdapterViewHolder

import android.widget.ToggleButton; //導入方法依賴的package包/類
StudentAdapterViewHolder(View itemView) {
    super(itemView);
    studentImage = (ImageView) itemView.findViewById(R.id.f_data_student_profile);
    studentDetail = (TextView) itemView.findViewById(R.id.input_cardview_name);
    editText = (EditText) itemView.findViewById(R.id.input_cardview_score);
    layout = (LinearLayout) itemView.findViewById(R.id.input_cardview_layout);
    txInit = (TextView) itemView.findViewById(R.id.input_cardview_init);
    btnMic = (ToggleButton) itemView.findViewById(R.id.input_cardview_mic);
    progressBar = (ProgressBar) itemView.findViewById(R.id.progressBarney);
    btnMic.setOnCheckedChangeListener(this);

    speech = SpeechRecognizer.createSpeechRecognizer(context);
    speech.setRecognitionListener(this);
    recognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, "en");
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, context.getPackageName());
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 3);
}
 
開發者ID:inteliedoit,項目名稱:thesis-project,代碼行數:20,代碼來源:ExamInputAdapter.java

示例3: initViews

import android.widget.ToggleButton; //導入方法依賴的package包/類
private void initViews() {
    latitudeInput = (EditText) findViewById(R.id.latitude_input);
    longitudeInput = (EditText) findViewById(R.id.longitude_input);
    mockLocationView = (TextView) findViewById(R.id.mock_location_view);
    updatedLocationView = (TextView) findViewById(R.id.updated_location_view);
    mockModeToggleButton = (ToggleButton) findViewById(R.id.toggle_button);
    setLocationButton = (Button) findViewById(R.id.set_location_button);

    mockModeToggleButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            setMockMode(isChecked);
            setLocationButton.setEnabled(isChecked);
        }
    });
    setLocationButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            addMockLocation();
        }
    });
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:23,代碼來源:MockLocationsActivity.java

示例4: ViewHolder

import android.widget.ToggleButton; //導入方法依賴的package包/類
public ViewHolder(View view) {
    super(view);
    mView = view;
    appNameTextView = (TextView) view.findViewById(R.id.appNameTextView);
    appPackageNameTextView = (TextView) view.findViewById(R.id.appPackageNameTextView);
    appIconImageView = (ImageView) view.findViewById(R.id.appIconImageView);
    hideAppToggleButton = (ToggleButton) view.findViewById(R.id.hideAppToggleButton);

    hideAppToggleButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            String packageName = appPackageNameTextView.getText().toString();
            if (isChecked) {
                hideAppsPreferenceUtility.addAppToHiddenAppsList(packageName);
            } else {
                hideAppsPreferenceUtility.removeAppToHiddenAppsList(packageName);
            }
        }
    });
}
 
開發者ID:varunon9,項目名稱:FakeLock,代碼行數:21,代碼來源:MyItemRecyclerViewAdapter.java

示例5: init

import android.widget.ToggleButton; //導入方法依賴的package包/類
public void init() {
    recyclerView = (RecyclerView) findViewById(R.id.teacher_schedule_recyclerview);
    btnSearch = (ToggleButton) findViewById(R.id._btn_search_schedule);
    btnSearchOk = (Button) findViewById(R.id._btn_search_ok_schedule);
    btnBack = (Button) findViewById(R.id.btn_back_schedule);
    editTextSearch = (EditText) findViewById(R.id.etxt_search_schedule);
    frameLayoutSearch = (FrameLayout) findViewById(R.id.frame_search_schedule);
    txtMsgContent = (TextView) findViewById(R.id.message_label_sc1);

    frameLayoutSearch.setVisibility(View.GONE);
    txtMsgContent.setVisibility(View.INVISIBLE);

    btnSearch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked)
                frameLayoutSearch.setVisibility(View.VISIBLE);
            else
                frameLayoutSearch.setVisibility(View.GONE);
        }
    });
}
 
開發者ID:inteliedoit,項目名稱:thesis-project,代碼行數:23,代碼來源:ScheduleViewActivity.java

示例6: onCreateView

import android.widget.ToggleButton; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    log.i("onCreateView");
    View rootView = inflater.inflate(R.layout.fragment_camera, container, false);

    mCameraManager = (CameraManager) getContext().getSystemService(Context.CAMERA_SERVICE);

    mHandlerThread = new HandlerThread("CameraFragment_HandlerThread");
    mHandlerThread.start();
    mHandler = new Handler(mHandlerThread.getLooper());

    ttv_camera = (AutoFitTextureView) rootView.findViewById(R.id.ttv_camera);
    ttv_camera.setSurfaceTextureListener(this);

    tbtn_camera = (ToggleButton) rootView.findViewById(R.id.tbtn_camera);
    tbtn_camera.setOnCheckedChangeListener(this);

    return rootView;
}
 
開發者ID:vipycm,項目名稱:mao-android,代碼行數:20,代碼來源:Camera2Fragment.java

示例7: onCreateView

import android.widget.ToggleButton; //導入方法依賴的package包/類
@SuppressLint("NewApi")
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final View rootView = inflater.inflate(R.layout.fragment_map, container, false);

    logTextView = (TextView) rootView.findViewById(R.id.textView1);

    final File filesDirectory = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
    fileMap = new File(filesDirectory, FILE_MAP);

    Utils.loadAd(rootView);
    setHasOptionsMenu(true);
    setupWebView(rootView);
    setupNmeaClientService();

    startStopButton = (ToggleButton) rootView.findViewById(R.id.startStopAisButton);
    startStopButton.setOnCheckedChangeListener(new OnCheckedChangeListener() {
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                startReceivingAisFromAntenna();
            } else {
                stopReceivingAisFromAntenna();
            }
        }
    });

    // TODO: Not possible to stop. Will start automatically when valid PPM exists and hide (stop) button for now
    startStopButton.setVisibility(View.GONE);
    return rootView;
}
 
開發者ID:videgro,項目名稱:Ships,代碼行數:33,代碼來源:ShowMapFragment.java

示例8: initView

import android.widget.ToggleButton; //導入方法依賴的package包/類
@Override
protected void initView(View root) {
    super.initView(root);
    mToggleFloatStart = (ToggleButton) root.findViewById(R.id.toggleFloatFirst);
    mToggleFloatEnd = (ToggleButton) root.findViewById(R.id.toggleFloatEnd);
    mToggleFloatStart.setOnCheckedChangeListener(this);
    mToggleFloatEnd.setOnCheckedChangeListener(this);
    mPageScrollView.setLogTag("scrollView");
    initPageScrollViewItemClick(mPageScrollView);
}
 
開發者ID:rexyren,項目名稱:PageScrollView,代碼行數:11,代碼來源:ExampleScrollViewFragment.java

示例9: initView

import android.widget.ToggleButton; //導入方法依賴的package包/類
protected void initView(View root) {
    mPageScrollView = (PageScrollView) root.findViewById(R.id.pageScrollView);
    mToggleAnim = (ToggleButton) root.findViewById(R.id.toggleTransform);
    mToggleCenter = (ToggleButton) root.findViewById(R.id.toggleChildCenter);
    mToggleAnim.setOnCheckedChangeListener(this);
    mToggleCenter.setOnCheckedChangeListener(this);
}
 
開發者ID:rexyren,項目名稱:PageScrollView,代碼行數:8,代碼來源:ExampleFragment.java

示例10: onCreate

import android.widget.ToggleButton; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    //requestWindowFeature(Window.FEATURE_NO_TITLE);
    //getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    setContentView(R.layout.activity_camera);

    mCameraManager = new CameraManager(this);

    mPreview = new CameraPreview(this, mCameraManager.getCamera());
    FrameLayout preview = (FrameLayout) findViewById(R.id.camera_preview);
    preview.addView(mPreview);

    mTextViewDigit = (TextView) findViewById(R.id.digit);
    mTextViewMatch = (TextView) findViewById(R.id.digit_match);

    mCaptureButton = (Button) findViewById(R.id.capture);
    mCaptureButton.setOnClickListener(this);

    mFlashToggle = (ToggleButton) findViewById(R.id.flash_toggle);
    mFlashToggle.setOnCheckedChangeListener(this);

    mDigitImageView = findViewById(R.id.digit_image);

    //ScheduledExecutorService ex = Executors.newSingleThreadScheduledExecutor();
    //ex.scheduleWithFixedDelay(this, 1, 2, TimeUnit.SECONDS);
}
 
開發者ID:dhiogoboza,項目名稱:iahandwritten,代碼行數:30,代碼來源:CameraActivity.java

示例11: onCreate

import android.widget.ToggleButton; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);


    viewPager = (ViewPager) findViewById(R.id.viewpager);
    setupViewPager(viewPager);

    tabLayout = (TabLayout) findViewById(R.id.tabs);
    tabLayout.setupWithViewPager(viewPager);


    btnSearch = (ToggleButton)findViewById(R.id.btn_search_class);
    btnSearchOk = (Button)findViewById(R.id._btn_search_ok_class);
    btnBack = (Button) findViewById(R.id.btn_back_student);
    editTextSearch =(EditText)findViewById(R.id.etxt_search_class);
    frameLayoutSearch = (FrameLayout)findViewById(R.id.frame_search_class);

    frameLayoutSearch.setVisibility(View.GONE);

    btnSearch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                frameLayoutSearch.setVisibility(View.VISIBLE);
                tabLayout.setVisibility(View.GONE);
            } else {
                frameLayoutSearch.setVisibility(View.GONE);
                tabLayout.setVisibility(View.VISIBLE);
            }
        }
    });
}
 
開發者ID:inteliedoit,項目名稱:thesis-project,代碼行數:34,代碼來源:Home_Activity.java

示例12: initUI

import android.widget.ToggleButton; //導入方法依賴的package包/類
private void initUI() {
    // init mVideoSurface
    mVideoSurface = (TextureView)findViewById(R.id.video_previewer_surface);

    recordingTime = (TextView) findViewById(R.id.timer);
    mCaptureBtn = (Button) findViewById(R.id.btn_capture);
    mRecordBtn = (ToggleButton) findViewById(R.id.btn_record);
    mShootPhotoModeBtn = (Button) findViewById(R.id.btn_shoot_photo_mode);
    mRecordVideoModeBtn = (Button) findViewById(R.id.btn_record_video_mode);
    mWayPointBtn=(Button)findViewById(R.id.btn_wayPoint);

    if (null != mVideoSurface) {
        mVideoSurface.setSurfaceTextureListener(this);
    }

    mCaptureBtn.setOnClickListener(this);
    mRecordBtn.setOnClickListener(this);
    mShootPhotoModeBtn.setOnClickListener(this);
    mRecordVideoModeBtn.setOnClickListener(this);
    mWayPointBtn.setOnClickListener(this);

    recordingTime.setVisibility(View.INVISIBLE);

    mRecordBtn.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                startRecord();
            } else {
                stopRecord();
            }
        }
    });
}
 
開發者ID:lupwei,項目名稱:Croprotector,代碼行數:35,代碼來源:UAVControllerActivity.java

示例13: onCreate

import android.widget.ToggleButton; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    
    db = new DatabaseHandler(this);
    
    dataIta = cursorToArray(db.getData("Ita"));
    dataEng = cursorToArray(db.getData("Eng"));
    
    btnAddFav = (StarView) findViewById(R.id.btnAddFav);
    btnCheckFav = (StarView) findViewById(R.id.btnCheckFav);
    
    fontReg = Typeface.createFromAsset(getAssets(), "fonts/ZillaSlab-Regular.ttf");
    fontIta = Typeface.createFromAsset(getAssets(), "fonts/ZillaSlab-Italic.ttf");
    fontBold = Typeface.createFromAsset(getAssets(), "fonts/ZillaSlab-Bold.ttf");

    tvTitle = (TextView) findViewById(R.id.tvTitle);
    tvTitle.setTypeface(fontBold);
    
    btnInfo = (ToggleButton) findViewById(R.id.btnInfo);
    
    tvIta = (TextView) findViewById(R.id.tvIta);
    tvIta.setTypeface(fontIta);
    
    tvEng = (TextView) findViewById(R.id.tvEng);
    tvEng.setTypeface(fontReg);
    
    tvMain = (TextView) findViewById(R.id.tvMain);

    btnInfo.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                tvMain.setVisibility(View.INVISIBLE);
                btnAddFav.setVisibility(View.INVISIBLE);
                showInfo();
            } else {
                tvMain.setVisibility(View.VISIBLE);
                btnAddFav.setVisibility(View.VISIBLE);
                changeSays();
            }
        }
    });

    tvMain.setOnTouchListener(new OnSwipeTouchListener(MainActivity.this) {
        @Override
        public void onSwipeRight() {changeSays(); }
        @Override
        public void onSwipeLeft() { changeSays(); }
    });

    changeSays();
}
 
開發者ID:francescosoave,項目名稱:TIS_android,代碼行數:54,代碼來源:MainActivity.java

示例14: onCreate

import android.widget.ToggleButton; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.flightmap);
    m_gMap = getMap();
    EditText t = findViewById(R.id.txtMapRoute);

    ImageButton b = findViewById(R.id.btnUpdateMapRoute);
    b.setOnClickListener(this);

    ImageButton btnExport = findViewById(R.id.btnExportGPX);
    btnExport.setOnClickListener(this);

    ToggleButton tb = findViewById(R.id.ckShowAllAirports);
    tb.setOnCheckedChangeListener(this);
    tb.setSelected(m_fShowAllAirports);

    Intent i = getIntent();

    String szRoute = i.getStringExtra(ROUTEFORFLIGHT);
    t.setText(szRoute);

    long idPending = i.getLongExtra(PENDINGFLIGHTID, 0);
    int idExisting = i.getIntExtra(EXISTINGFLIGHTID, 0);
    long idNew = i.getIntExtra(NEWFLIGHTID, 0);

    if (idPending > 0) {
        m_le = new LogbookEntry(idPending);

        if (m_le.IsPendingFlight()) {
            this.m_rgFlightRoute = LocSample.samplesFromDataString(m_le.szFlightData);
            m_GPXPath = GPX.getFlightDataStringAsGPX(m_rgFlightRoute);    // initialize the GPX path
        }
    } else if (idExisting > 0) {
        m_le = RecentFlightsSvc.GetCachedFlightByID(idExisting);
        FetchFlightPathTask ffpt = new FetchFlightPathTask();
        new Thread(ffpt).start();
    } else if (idNew != 0) {
        m_le = MFBMain.getNewFlightListener().getInProgressFlight(this);
        this.m_rgFlightRoute = LocSample.flightPathFromDB();
        m_GPXPath = GPX.getFlightDataStringAsGPX(m_rgFlightRoute);    // initialize the GPX path.
    } else // all airports
    {
        t.setVisibility(View.GONE);
        b.setVisibility(View.GONE);
    }
}
 
開發者ID:ericberman,項目名稱:MyFlightbookAndroid,代碼行數:49,代碼來源:ActFlightMap.java


注:本文中的android.widget.ToggleButton.setOnCheckedChangeListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。