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:hongik.android.project.best.ReviewActivity.java

public void reviewClick(View view) {
    if (view.getId() == R.id.review_submit) {
        String note = ((EditTextPlus) findViewById(R.id.review_text)).getText().toString();
        float grade = ((RatingBar) findViewById(R.id.review_grade)).getRating();

        String query = "func=submitreview" + "&license=" + license + "&cid=" + cid + "&note=" + note + "&grade="
                + grade;//from   ww w.j  av a2  s.co m
        DBConnector conn = new DBConnector(query);
        conn.start();

        try {
            conn.join();
            JSONObject jsonResult = conn.getResult();
            boolean result = jsonResult.getBoolean("result");

            if (!result) {
                Toast.makeText(this, "Submit Error", Toast.LENGTH_SHORT).show();
                setResult(0, new Intent());
                finish();
                return;
            }
            Toast.makeText(this, "Thank you for your opinion", Toast.LENGTH_SHORT).show();
            setResult(1, new Intent());
            finish();
        } catch (Exception e) {
        }
    }
}

From source file:com.may.ple.parking.gateway.activity.GateInActivity.java

public void onClick(View view) {

    if (view.getId() == R.id.delete) {
        if (licenseNo.length() > 0)
            licenseNo = licenseNo.substring(0, licenseNo.length() - 1);
    } else {//from   w w  w. j av a  2 s . c  o m
        if (licenseNo.length() >= lenght)
            return;

        licenseNo += ((Button) view).getText();
    }

    show.setText(licenseNo);
}

From source file:com.guendouz.dzgeekhangout.OpenWeatherMapExample.java

@Override
public void onClick(View v) {
    if (v.getId() == R.id.btnGetWeatherInfo) {
        new OpenWeatherMapRequest().execute();

    }/*from ww w  . j a v a 2 s.c o  m*/

}

From source file:com.wooi.vibox.demo.MainActivity.java

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.button:
        HashMap<String, String> paramsMap = new HashMap<>();
        paramsMap.put("access_token", "2.00FLsKEC0JZ_wrb789018166ZPyBUC");
        paramsMap.put("uid", "1893962551");
        RequestParams params = new RequestParams(paramsMap);
        HttpUtiltest.get("https://api.weibo.com/2/users/show.json", params, new JsonHttpResponseHandler() {
            @Override/*from  w  w w  . j  a va 2  s .co  m*/
            public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
                super.onSuccess(statusCode, headers, response);
                Log.i("TAG", response.toString());
            }

            @Override
            public void onFailure(int statusCode, Header[] headers, Throwable throwable,
                    JSONObject errorResponse) {
                super.onFailure(statusCode, headers, throwable, errorResponse);
                Log.i("TAG", errorResponse.toString());

            }
        });
        break;
    }
}

From source file:com.may.ple.parking.gateway.activity.GateOutActivity.java

public void onClick(View v) {
    if (v.getId() == R.id.scan) {
        Intent intent = new Intent(this, BarcodeScanner.class);
        startActivity(intent);/*from ww  w  .  j a v  a 2 s  .  com*/
    } else if (v.getId() == R.id.type) {
        openContextMenu(v);
    } else if (v.getId() == R.id.lastCheckOut && dialog != null) {
        dialog.show();
    }
}

From source file:com.ibm.sample.travelbuddy.MainActivity.java

@Override
public void onClick(View view) {
    switch (view.getId()) {
    case R.id.searchBtn:
        doSearch();// www .  j  a v  a 2 s .  c o  m
        break;

    case R.id.clearBtn:
        doClear();
        break;

    default:
        break;
    }
}

From source file:com.may.ple.parking.gateway.activity.GateInActivity.java

@Override
public boolean onLongClick(View v) {

    if (v.getId() == R.id.show) {
        if (licenseNo == null || licenseNo.trim().length() == 0)
            return false;

        show.setBackgroundResource(R.drawable.text_show_sent);
        show.setTextColor(Color.parseColor("#000000"));

        if (isCheckOut) {
            Intent returnIntent = new Intent();
            returnIntent.putExtra("result", licenseNo);
            setResult(RESULT_OK, returnIntent);
            finish();//from  w w w.  ja va  2s. c o  m
            return true;
        }

        VehicleSaveCriteriaReq req = new VehicleSaveCriteriaReq();
        req.licenseNo = licenseNo;
        req.deviceId = ApplicationScope.getInstance().deviceId;
        req.gateName = gateName;

        service.send(1, req, VehicleSaveCriteriaResp.class, "/restAct/vehicle/saveVehicleParking",
                HttpMethod.POST);
        spinner.show();
    } else {
        licenseNo = "";
        show.setText(licenseNo);
    }
    return true;
}

From source file:com.eincs.athens.android.OlympusFeedActivity.java

public void onClick(View v) {
    if (v.getId() == R.id.btn_write) {
        Intent intent = new Intent(this, OlympusWriteActivity.class);
        startActivity(intent);//  w  w w.  java  2s.  co m
    }
}

From source file:com.eincs.athens.android.OlympusWriteActivity.java

public void onClick(View v) {
    if (v.getId() == R.id.btn_write_submit) {

        final String content = mContent.getText().toString();
        final HttpClient httpClient = new DefaultHttpClient();
        new DefaultAsyncTask<JSONObject>(ProgressDialogs.createDialog(this)) {

            @Override//from www .  j ava  2s. c o  m
            protected JSONObject doInBackground(Object... params) {
                Uri uri = Uri.parse(OlympusConst.SERVER_HOST + OlympusConst.PATH_WRITE);
                HttpPost httpPost = new HttpPost(uri.toString());
                httpPost.addHeader(OlympusConst.HEADER_ACCESS_TOKEN, mPref.getAccessToken());
                ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
                nameValuePairs.add(new BasicNameValuePair("content", content));

                try {
                    httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs, "UTF-8"));
                    JSONObject result = httpClient.execute(httpPost, new JSONResponseHandler());
                    return result;

                } catch (Exception e) {
                    Log.e("Olympus", e.getMessage(), e);
                    return null;
                }
            }

            protected void onPostExecute(JSONObject result) {
                super.onPostExecute(result);

                if (result == null) {
                    Toast.makeText(mContext, "error", Toast.LENGTH_SHORT).show();
                } else if (result.has("error")) {
                    try {
                        Toast.makeText(mContext, result.getString("error"), Toast.LENGTH_SHORT).show();
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                } else {
                    finish();
                }
            };
        }.execute();

    } else if (v.getId() == R.id.btn_write_cancel) {
        finish();
    }
}