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:com.insthub.O2OMobile.Activity.C4_EditIntroActivity.java

@Override
public void onClick(View v) {
    String brief = mBrief.getText().toString().trim();
    switch (v.getId()) {
    case R.id.top_view_back:
        finish();//from www  .  ja  v  a  2s .  co  m
        break;
    case R.id.btn_save:
        if ("".equals(brief)) {
            ToastView toast = new ToastView(C4_EditIntroActivity.this,
                    getString(R.string.brief_wrong_format_hint));
            toast.setGravity(Gravity.CENTER, 0, 0);
            toast.show();
            mBrief.setText("");
            mBrief.requestFocus();
            break;
        } else {
            mUserModel.changeBrief(brief);
        }
    }
}

From source file:hongik.android.project.best.StoreActivity.java

public void storeClick(View view) {
    if (view.getId() == R.id.store_more) {
        Intent storeReviewIntent = new Intent(this, StoreReviewActivity.class);
        storeReviewIntent.putExtra("LICENSE", license);
        startActivity(storeReviewIntent);
    }//from  w  w w.j  a  va  2 s  . co m
}

From source file:com.qiqi8226.http.MainActivity.java

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.btnClientGet:
        onBtnClientGet();//  w w  w.  j a v a 2  s. c  o  m
        break;
    case R.id.btnClientPost:
        onBtnClientPost();
        break;
    case R.id.btnGet:
        onBtnGet();
        break;
    case R.id.btnPost:
        onBtnPost();
        break;
    }
}

From source file:cn.com.incardata.autobon_shops.CooperativeThreeActivity.java

@Override
public void onClick(View view) {
    switch (view.getId()) {
    case R.id.iv_back:
        finish();//from w ww .j a v  a  2s .  c o  m
        break;
    case R.id.tv_protocal:
        startActivity(ServiceProtocalActivity.class);
        break;
    case R.id.join_btn:
        submitInfo();
        break;
    }
}

From source file:moe.minori.androidoauthtutorialproject.MainActivity.java

/**
 * Called when button is pressed - calling method's name is defined by layout XML, and must have View param.
 *
 * @param v/*  w  ww .  j  a va2  s .  c o m*/
 */
public void onClick(View v) {
    if (v.getId() == R.id.getTokensViaOAuthButton) // First button, get Access Token & Refresh Token via Chrome Custom Tab
    {
        // In order to use Chrome Custom Tab, phone must have modern Chrome for Android installed

        // We will use Support Library to avoid using AIDL interface
        CustomTabsIntent customTabsIntent = new CustomTabsIntent.Builder().build();

        // Since some API requires user to use Custom Tabs, we will not provide failback to webview - notice null param.
        CustomTabActivityHelper customTabActivityHelper = new CustomTabActivityHelper();

        // Implicit grant flow request URL params variable - since we don't have web server.
        ArrayList<Pair<String, String>> urlParams = new ArrayList<>();

        urlParams.add(new Pair<>("client_id", Constants.clientId));
        urlParams.add(new Pair<>("response_type", "token"));
        urlParams.add(new Pair<>("scope", "profile"));
        urlParams.add(new Pair<>("redirect_uri", "http://kawaii.na.minori.ga/fitbitDuctTapeParser.html"));
        urlParams.add(new Pair<>("prompt", "consent"));

        CustomTabActivityHelper.openCustomTab(this, customTabsIntent,
                Uri.parse(RESTRequestParamUtil.paramURLfier(Constants.authURL, urlParams)), null);

    } else if (v.getId() == R.id.accessApiButton) // Second button, Access to API with Access Token
    {
        // Since we are dealing with network methods, we will use AsyncTask.

        new AsyncTask<Void, Void, String>() {
            @Override
            protected String doInBackground(Void... params) {
                // this block will not be executed in UI thread

                // try simple API request - profile reading

                // for API request, we need access token and HTTP GET request

                String result = null;

                try {
                    HttpClient httpClient = new DefaultHttpClient();
                    HttpGet request = new HttpGet();
                    request.setURI(new URI(Constants.accessEndpointURL));

                    // add authorization params - BASIC
                    request.setHeader("Authorization", "Bearer " + accessToken);

                    HttpResponse response = httpClient.execute(request);

                    result = StreamUtil.convertStreamToString(response.getEntity().getContent());

                } catch (URISyntaxException | IOException e) {
                    e.printStackTrace();
                }

                accessResult = result;

                return result;
            }

            @Override
            protected void onPostExecute(String s) {
                super.onPostExecute(s);
                // this block will be executed in UI thread

                // from onResume()
                EditText accessResultEditText = (EditText) findViewById(R.id.accessResultEditText);
                if (accessResult != null)
                    accessResultEditText.setText(accessResult);
            }
        }.execute();
    }
}

From source file:com.app.jdy.ui.MyOrderActivity.java

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.back_img:
        finish();/*from  ww w.  j a  v  a 2  s.co m*/
        break;
    case R.id.right_img:
        Intent intent = new Intent(MyOrderActivity.this, OrderFeedBackActivity.class);
        startActivity(intent);
        break;
    default:
        break;
    }
}

From source file:com.example.mysqltest.ScanBarcode.java

public void onClick(View v) {
    //respond to clicks
    Intent i;/* ww  w .  j  a v  a 2s .  co m*/
    if (v.getId() == R.id.scan_button) {
        IntentIntegrator scanIntegrator = new IntentIntegrator(this);
        scanIntegrator.initiateScan();
    } else if (v.getId() == R.id.barContButton) {

        i = new Intent(this, ScanAndPay.class);
        startActivity(i);

    }
}

From source file:com.insthub.O2OMobile.Activity.C12_EditSignatureActivity.java

@Override
public void onClick(View v) {
    String signture = mSignture.getText().toString().trim();
    switch (v.getId()) {
    case R.id.top_view_back:
        finish();//from  ww  w . ja v  a2  s .  c  o m
        break;
    case R.id.btn_save:
        if ("".equals(signture)) {
            ToastView toast = new ToastView(C12_EditSignatureActivity.this,
                    getString(R.string.signature_not_null));
            toast.setGravity(Gravity.CENTER, 0, 0);
            toast.show();
            mSignture.setText("");
            mSignture.requestFocus();
            break;
        } else {
            mUserModel.changeSignature(signture);
        }
    }
}

From source file:com.chess.genesis.activity.Settings.java

@Override
public boolean onLongClick(final View v) {
    if (v.getId() == R.id.topbar_genesis) {
        finish();/*from   www. j a  v a  2  s. c o m*/
        return true;
    }
    return false;
}

From source file:com.insthub.O2OMobile.Activity.D3_OrderCommentActivity.java

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.d12_star_one:
        selectRank(1);/*from   ww w . ja  v a 2 s. c o m*/
        break;
    case R.id.d12_star_two:
        selectRank(2);
        break;
    case R.id.d12_star_three:
        selectRank(3);
        break;
    case R.id.d12_star_four:
        selectRank(4);
        break;
    case R.id.d12_star_five:
        selectRank(5);
        break;
    case R.id.d12_publish_button: {
        if (mCommentRank == 0) {
            ToastView toast = new ToastView(this, getString(R.string.please_choose_servic_evaluation));
            toast.setGravity(Gravity.CENTER, 0, 0);
            toast.show();
        } else {
            if (null != mOrder_info) {
                mCommentModel.comment(mCommentContent.getText().toString(), mCommentRank, mOrder_info.id);
            } else {
                mCommentModel.comment(mCommentContent.getText().toString(), mCommentRank, 1);
            }

        }
    }
    }
}