Android Open Source - sdl_tester_android Read Dids Dialog

From Project

Back to project page sdl_tester_android.


The source code is released under:

Copyright (c) 2014, Ford Motor Company All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are m...

If you think the Android project sdl_tester_android 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 com.livio.sdltester.dialogs;
/*from ww  w . ja v  a  2 s .  co m*/
import android.content.Context;
import android.content.DialogInterface;
import android.text.InputFilter;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

import com.livio.sdl.SdlConstants;
import com.livio.sdl.SdlRequestFactory;
import com.livio.sdl.dialogs.BaseOkCancelDialog;
import com.livio.sdl.enums.SdlCommand;
import com.livio.sdl.viewhelpers.MinMaxInputFilter;
import com.livio.sdltester.R;
import com.smartdevicelink.proxy.RPCRequest;

public class ReadDidsDialog extends BaseOkCancelDialog {

  // TODO didLocation should be comma-separated.
  private static final SdlCommand SYNC_COMMAND = SdlCommand.READ_DIDS;
  private static final String DIALOG_TITLE = SYNC_COMMAND.toString();
  private static final int MIN_ECU_NUMBER = SdlConstants.ReadDidsConstants.MINIMUM_ECU_ID;
  private static final int MAX_ECU_NUMBER = SdlConstants.ReadDidsConstants.MAXIMUM_ECU_ID;
  private EditText et_ecuName, et_didLocation;
  public ReadDidsDialog(Context context) {
    super(context, DIALOG_TITLE, R.layout.read_dids);

  protected void findViews(View parent) {
    et_ecuName = (EditText) parent.findViewById(;
    et_ecuName.setFilters(new InputFilter[]{new MinMaxInputFilter(MIN_ECU_NUMBER, MAX_ECU_NUMBER)});
    et_didLocation = (EditText) parent.findViewById(;
    et_didLocation.setFilters(new InputFilter[]{new MinMaxInputFilter(MIN_ECU_NUMBER, MAX_ECU_NUMBER)});
  //dialog button listeners
  private final DialogInterface.OnClickListener okButtonListener = new DialogInterface.OnClickListener() {
    public void onClick(DialogInterface dialog, int which) {
      final String ecuName = et_ecuName.getText().toString();
      final String didLocation = et_didLocation.getText().toString();
      if(ecuName.length() > 0 && didLocation.length() > 0){
        RPCRequest result = SdlRequestFactory.readDid(Integer.parseInt(ecuName), Integer.parseInt(didLocation));
        Toast.makeText(context, "Must enter ECU name & DID location.", Toast.LENGTH_LONG).show();


Java Source Code List