Example usage for android.view View getId

List of usage examples for android.view View getId

Introduction

In this page you can find the example usage for android.view View getId.

Prototype

@IdRes
@ViewDebug.CapturedViewProperty
public int getId() 

Source Link

Document

Returns this view's identifier.

Usage

From source file:kr.co.cashqc.MainActivity.java

public void mOnClick(View view) {
    switch (view.getId()) {
    case R.id.manual_location:
        Intent i = new Intent(this, MapActivity.class);
        i.putExtra("lat", mLatitude);
        i.putExtra("lng", mLongitude);
        startActivity(i);/* w  w  w  .j  av  a  2 s  . c o m*/
        break;
    }

}

From source file:auribises.com.visitorbook.Activites.AdminEntryActivity.java

public void onclickadmin(View view) {
    if (view.getId() == R.id.buttonSubmit) {
        btnSubmit.setOnClickListener(this);

        adminentry.setName(eTxtName.getText().toString().trim());
        adminentry.setPhone(eTxtPhone.getText().toString().trim());
        adminentry.setEmail(eTxtEmail.getText().toString().trim());
        adminentry.setAddress(eTxtAddress.getText().toString().trim());
        adminentry.setPurpose(eTxtPurpose.getText().toString().trim());
        adminentry.setDate(eTxtDate.getText().toString().trim());
        adminentry.setTime(eTxtTime.getText().toString().trim());
        adminentry.setAdmin(eTxtAdmin.getText().toString().trim());
        adminentry.setIDProofnumber(eTxtIDProofNumber.getText().toString().trim());
        adminentry.setVehiclenumber(eTxtVehicleNumber.getText().toString().trim());

        //insertIntoDB();

        if (validateFields()) {
            if (isNetworkConected())
                insertIntoCloud();//from   w  ww. ja va  2s .  co m
        } else
            Toast.makeText(this, "Please connect to Internet", Toast.LENGTH_LONG).show();
    } else {
        Toast.makeText(this, "Please correct Input", Toast.LENGTH_LONG).show();
    }
}

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

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.today_export_layout:
        // ?//www.j a va 2s  .c  o m
        if (todayExpert != null) {
            Intent intent1 = new Intent(ExportConsultMainActivity.this, ExpertInfoActivity.class);
            intent1.putExtra("id", todayExpert.getFkUserId());
            startActivity(intent1);
        }
        break;
    case R.id.tomorrow_export_layout:
        // ?
        if (tomorrowExpert != null) {
            Intent intent2 = new Intent(ExportConsultMainActivity.this, ExpertInfoActivity.class);
            intent2.putExtra("id", tomorrowExpert.getFkUserId());
            startActivity(intent2);
        }
        break;
    case R.id.nearly_consult:
        Intent newIntent = new Intent(ExportConsultMainActivity.this, HotRecConsultListActivity.class);
        newIntent.putExtra("type", "new");
        startActivity(newIntent);
        break;
    case R.id.hot_consult:
        Intent hotIntent = new Intent(ExportConsultMainActivity.this, HotRecConsultListActivity.class);
        hotIntent.putExtra("type", "hot");
        startActivity(hotIntent);
        break;
    case R.id.more_export:
        // 
        startActivity(new Intent(ExportConsultMainActivity.this, MoreExpertActivity.class));
        break;
    default:
        break;
    }
}

From source file:edu.mit.mobile.android.locast.accounts.AbsLocastAuthenticatorActivity.java

@Override
public void onClick(View v) {
    if (v.getId() == R.id.login) {
        handleLogin();//  w w w  .ja va 2  s  .c o m
    } else if (v.getId() == R.id.cancel) {
        finish();
    } else if (v.getId() == R.id.register) {
        startActivityForResult(getSignupIntent(), REQUEST_REGISTER);
    }
}

From source file:com.poomoo.edao.activity.UploadPicsActivity.java

@Override
public void onClick(View v) {
    // TODO ?/*from ww  w  .jav a 2  s .c  om*/
    switch (v.getId()) {
    case R.id.uploadpics_textView_example1:
        show_example(res[0]);
        break;
    case R.id.uploadpics_textView_example2:
        show_example(res[1]);
        break;
    case R.id.uploadpics_layout_identitycard_front:
        flag = 1;
        // select_pics();
        getPicByCamera();
        break;
    case R.id.uploadpics_layout_identitycard_back:
        flag = 2;
        // select_pics();
        getPicByCamera();
        break;
    case R.id.uploadpics_layout_identitycard_inhand:
        flag = 3;
        // select_pics();
        getPicByCamera();
        break;
    case R.id.uploadpics_layout_businesss_license:
        flag = 4;
        // select_pics();
        getPicByCamera();
        break;
    case R.id.uploadpics_btn_upload:

        if (checkInput()) {
            showProgressDialog("...");
            // test();
            new Thread(new Runnable() {
                @Override
                public void run() {
                    // TODO ?
                    uploadCount = 0;
                    upload(filelist.get(uploadCount));
                }
            }).start();
        }
        break;
    }

}

From source file:com.duy.pascal.ui.file.fragment.FragmentFileManager.java

@Override
public void onClick(View v) {
    int i = v.getId();
    switch (i) {//from   w  w  w .  j  a  v  a 2  s. c  om
    case R.id.action_new_file:
        createNewFile();
        mFabMenu.close(true);
        break;
    case R.id.action_new_folder:
        createNewFolder();
        mFabMenu.close(true);
        break;
    case R.id.img_sort_date:
        sortByDate(v);
        break;
    case R.id.img_sort_name:
        sortByName();
        break;
    case R.id.img_sort_size:
        sortBySize();
        break;
    }
}

From source file:com.quarterfull.newsAndroid.NewsDetailFragment.java

@SuppressLint("SetJavaScriptEnabled")
private void init_webView() {
    int backgroundColor = ColorHelper.getColorFromAttribute(getContext(), R.attr.news_detail_background_color);
    mWebView.setBackgroundColor(backgroundColor);

    WebSettings webSettings = mWebView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webSettings.setAllowFileAccess(true);
    webSettings.setDomStorageEnabled(true);
    webSettings.setJavaScriptCanOpenWindowsAutomatically(false);
    webSettings.setSupportMultipleWindows(false);
    webSettings.setSupportZoom(false);/* w w w  .  j  a  v a2s. c o  m*/
    webSettings.setAppCacheEnabled(true);

    registerForContextMenu(mWebView);

    mWebView.setWebChromeClient(new WebChromeClient() {
        @Override
        public boolean onConsoleMessage(ConsoleMessage cm) {
            Log.v(TAG, cm.message() + " at " + cm.sourceId() + ":" + cm.lineNumber());
            return true;
        }

        @Override
        public void onProgressChanged(WebView view, int progress) {
            if (progress < 100 && mProgressbarWebView.getVisibility() == ProgressBar.GONE) {
                mProgressbarWebView.setVisibility(ProgressBar.VISIBLE);
            }
            mProgressbarWebView.setProgress(progress);
            if (progress == 100) {
                mProgressbarWebView.setVisibility(ProgressBar.GONE);

                //The following three lines are a workaround for websites which don't use a background color
                int bgColor = ContextCompat.getColor(getContext(),
                        R.color.slider_listview_text_color_dark_theme);
                NewsDetailActivity ndActivity = ((NewsDetailActivity) getActivity());
                mWebView.setBackgroundColor(bgColor);
                ndActivity.mViewPager.setBackgroundColor(bgColor);

                if (ThemeChooser.isDarkTheme(getActivity())) {
                    mWebView.setBackgroundColor(
                            ContextCompat.getColor(getContext(), android.R.color.transparent));
                }
            }
        }
    });

    mWebView.setWebViewClient(new WebViewClient() {

        @Override
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            if (changedUrl) {
                changedUrl = false;

                if (!url.equals("file:///android_asset/") && (urls.isEmpty() || !urls.get(0).equals(url))) {
                    urls.add(0, url);

                    Log.v(TAG, "Page finished (added): " + url);
                }
            }

            super.onPageStarted(view, url, favicon);
        }
    });

    mWebView.setOnTouchListener(new View.OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (v.getId() == R.id.webview && event.getAction() == MotionEvent.ACTION_DOWN) {
                changedUrl = true;
            }

            return false;
        }
    });
}

From source file:com.chalmers.schmaps.GoogleMapSearchLocation.java

/**
 * If the enter button is clicked a room search is done
 * If the get directions button is pressed you get the path drawn on map
 * but you have to search for a room first
 *///  w  w  w . j a  v a2s.  c o  m
public void onClick(View v) {

    switch (v.getId()) {

    case R.id.edittextbutton:
        //Removes the key when finish typing
        InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(lectureEdit.getWindowToken(), 0);
        //removes the path drawn if there is one
        mapOverlays.remove(pathOverlay);
        //removes the dot that point to a previous room found
        mapOverlays.remove(mapItemizedRoom);
        roomToFind = lectureEdit.getText().toString();
        //removes white signs and converts to lower case
        roomToFind.toLowerCase().trim();
        //Removes illegal characters to prevent sql injection
        roomToFind = roomToFind.replaceAll("[^[a-z][A-Z][0-9]]", "");
        //Set the field variable so it can be tested.
        setRoomToFind(roomToFind);
        //open database in read mode
        search.openRead();
        //if we find room show room on map, if not show dialog 
        if (search.exists(roomToFind)) {
            //create a geopoint
            roomLocation = new GeoPoint(search.getLat(roomToFind), search.getLong(roomToFind));
            mapcon = mapView.getController();
            mapcon.animateTo(roomLocation);
            //zoom level
            mapcon.setZoom(OVERVIEWZOOMVALUE);
            //address and level is shown in the dialog
            overlayItemRoom = new OverlayItem(roomLocation, search.getAddress(roomToFind),
                    search.getLevel(roomToFind));
            mapItemizedRoom.removeOverlay();
            mapItemizedRoom.addOverlay(overlayItemRoom);
            mapOverlays.add(mapItemizedRoom);
            mapView.postInvalidate();
            //now someone has searched for a room, set the boolean to true
            roomSearched = true;
        } else {
            //dilaog pops up if room not found
            dialog = new Dialog(GoogleMapSearchLocation.this);
            dialog.setTitle("Sorry, can not find the room :(");
            dialog.setCanceledOnTouchOutside(true);
            dialog.show();
        }
        //close database
        search.close();
        break;

    case R.id.directionbutton:
        Log.e("roomsearched", "in");
        //if there there is roomLocation then search for a path
        //if not a roomLocation then the user has not searched for a room, do not give directions
        if (gotInternetConnection()) {
            Log.e("roomsearched", "inin");
            if (roomSearched) {
                walkningDirections();
                roomSearched = false;
            } else {
                Context context = getApplicationContext();
                Toast.makeText(context, "Search for a room first to get directions", Toast.LENGTH_LONG).show();

            }
        } else {
            Context context = getApplicationContext();
            Toast.makeText(context, "Internet connection needed for this option", Toast.LENGTH_LONG).show();
        }

        break;

    }

}

From source file:com.dtr.zxing.activity.CaptureActivity.java

@Override
public void onClick(View v) {
    // TODO Auto-generated method stub
    switch (v.getId()) {
    case R.id.capture_flash:
        light();//from w  ww.j a v a  2  s .  c  o m
        break;

    default:
        break;
    }
}

From source file:com.easemob.chatuidemo.ui.MainActivity.java

/**
 * button/*from   ww  w.  j a v a 2  s  .c om*/
 * 
 * @param view
 */
public void onTabClicked(View view) {
    switch (view.getId()) {
    case R.id.btn_conversation:
        index = 0;
        break;
    case R.id.btn_address_list:
        index = 1;
        break;
    case R.id.btn_setting:
        index = 2;
        break;
    }
    if (currentTabIndex != index) {
        FragmentTransaction trx = getSupportFragmentManager().beginTransaction();
        trx.hide(fragments[currentTabIndex]);
        if (!fragments[index].isAdded()) {
            trx.add(R.id.fragment_container, fragments[index]);
        }
        trx.show(fragments[index]).commit();
    }
    mTabs[currentTabIndex].setSelected(false);
    // ?tab?
    mTabs[index].setSelected(true);
    currentTabIndex = index;
}