Example usage for android.widget ArrayAdapter ArrayAdapter

List of usage examples for android.widget ArrayAdapter ArrayAdapter

Introduction

In this page you can find the example usage for android.widget ArrayAdapter ArrayAdapter.

Prototype

public ArrayAdapter(@NonNull Context context, @LayoutRes int resource) 

Source Link

Document

Constructor

Usage

From source file:com.spondbob.bluetooth.BluetoothActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Setup the window
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    setContentView(R.layout.device_list);

    // Set result CANCELED in case the user backs out
    setResult(Activity.RESULT_CANCELED);

    // Initialize array adapters. One for already paired devices and
    // one for newly discovered devices
    mNewDevicesArrayAdapter = new ArrayAdapter<String>(this, R.layout.device_name);

    // Find and set up the ListView for newly discovered devices
    newDevicesListView = (ListView) findViewById(R.id.new_devices);
    newDevicesListView.setAdapter(mNewDevicesArrayAdapter);

    // Register for broadcasts when a device is discovered
    IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);
    this.registerReceiver(mReceiver, filter);

    // Register for broadcasts when discovery has finished
    filter = new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
    this.registerReceiver(mReceiver, filter);

    // Get the local Bluetooth adapter
    mBtAdapter = BluetoothAdapter.getDefaultAdapter();
}

From source file:li.klass.fhem.fragments.SendCommandFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);

    final View view = inflater.inflate(R.layout.command_execution, container, false);
    Button sendButton = (Button) view.findViewById(R.id.send);
    sendButton.setOnClickListener(new View.OnClickListener() {
        @Override/*from  w w  w .java2s .  c om*/
        public void onClick(View button) {
            EditText editText = (EditText) view.findViewById(R.id.input);
            String command = editText.getText().toString();

            sendCommandIntent(command);
        }
    });

    ListView recentCommandsList = (ListView) view.findViewById(R.id.command_history);
    recentCommandsAdapter = new ArrayAdapter<>(getActivity(), android.R.layout.simple_list_item_1);
    recentCommandsList.setAdapter(recentCommandsAdapter);
    recentCommandsList.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
            String command = recentCommands.get(position);
            sendCommandIntent(command);
        }
    });

    return view;
}

From source file:com.pixellostudio.qqdroid.BaseQuote.java

/** Called when the activity is first created. */
@Override/* w  ww .j a  va2 s .  c  o m*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setActionBarContentView(R.layout.show);

    getActionBar().setTitle(title);

    getActionBar().addItem(getActionBar().newActionBarItem(NormalActionBarItem.class)
            .setDrawable(R.drawable.seemore).setContentDescription("List"), R.id.actionbar_seemore);

    view = (ListView) findViewById(R.id.ListView);

    view.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {
        public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
            menu.add(0, 1, 0, R.string.sharequote);
        }
    });

    adapter = new ArrayAdapter<String>(getBaseContext(), android.R.layout.simple_list_item_1);
    adapter2 = new ArrayAdapter<String>(getBaseContext(), android.R.layout.simple_list_item_1) {
        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(BaseQuote.this);

            TextView txt = new TextView(this.getContext());
            txt.setTextSize(Float.parseFloat(pref.getString("policesize", "20")));
            txt.setText(Html.fromHtml(this.getItem(position)));

            if (pref.getString("design", "blackonwhite").equals("blackonwhite")) {
                txt.setTextColor(Color.BLACK);
                txt.setBackgroundColor(Color.WHITE);
                txt.setBackgroundDrawable(
                        this.getContext().getResources().getDrawable(R.drawable.quote_gradient_white));
            } else if (pref.getString("design", "blackonwhite").equals("whiteonblack")) {
                txt.setTextColor(Color.WHITE);
                txt.setBackgroundColor(Color.BLACK);
                txt.setBackgroundDrawable(
                        this.getContext().getResources().getDrawable(R.drawable.quote_gradient_black));
            }

            return txt;
        }

    };

    String[] liste = (String[]) getLastNonConfigurationInstance();

    if (liste != null && liste.length != 0) {
        for (int i = 0; i < liste.length; i++) {
            adapter.add(liste[i]);
            adapter2.add(liste[i]);
        }

        this.setTitle(name);
    } else {
        new LoadQuotes().execute();
    }

    view.setAdapter(adapter2);
}

From source file:com.microsoft.windowsazure.messaging.e2etestapp.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ApplicationContext.setContext(this);

    setContentView(R.layout.activity_main);

    mTestCaseList = (ListView) findViewById(R.id.testCaseList);
    TestCaseAdapter testCaseAdapter = new TestCaseAdapter(this, R.layout.row_list_test_case);
    mTestCaseList.setAdapter(testCaseAdapter);

    mTestGroupSpinner = (Spinner) findViewById(R.id.testGroupSpinner);

    ArrayAdapter<TestGroup> testGroupAdapter = new ArrayAdapter<TestGroup>(this,
            android.R.layout.simple_spinner_item);
    mTestGroupSpinner.setAdapter(testGroupAdapter);
    mTestGroupSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        @Override//from  ww w  . j  ava  2s .co  m
        public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
            selectTestGroup(pos);
        }

        @Override
        public void onNothingSelected(AdapterView<?> arg0) {
            // do nothing
        }
    });

    refreshTestGroupsAndLog();
}

From source file:br.ufsc.das.gtscted.shibbauth.ShibAuthenticationActivity.java

/** Called when the activity is first created. */
@Override/* w ww. jav  a2 s  . co m*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.idp_selection);
    loginButton = (Button) findViewById(R.id.loginButton);
    backButton = (Button) findViewById(R.id.backButton);
    usernameTxt = (EditText) findViewById(R.id.usernameTxt);
    passwordTxt = (EditText) findViewById(R.id.passwordTxt);
    idpSpinner = (Spinner) findViewById(R.id.idpSpinner);

    //Configura o ArrayAdapter do spinner.
    ArrayAdapter<CharSequence> spinnerArrayAdapter;
    spinnerArrayAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item);
    spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    idpSpinner.setAdapter(spinnerArrayAdapter);

    // Obtm os parmetros passados pela Activity anterior 
    // (no caso, a pgina do WAYF como uma String e o
    // nico cookie da Connection usada anteriormente)
    Bundle bundle = this.getIntent().getExtras();
    String wayfHtml = bundle.getString("html_source");
    final String wayfLocation = bundle.getString("wayf_location");
    final SerializableCookie receivedCookie = (SerializableCookie) bundle.getSerializable("cookie");

    //Obtm todos os tags de nome "option", que correspondem
    // aos IdPs, da pgina do WAYF.
    Document wayfDocument = Jsoup.parse(wayfHtml);
    idpElements = wayfDocument.select("option");

    //Popula o spinner com os nomes dos IdPs encontrados.      
    for (Element idpElement : idpElements) {
        String idpName = idpElement.text();
        spinnerArrayAdapter.add(idpName);
    }

    // Obtm o caminho para o qual deve ser passado o IdP do usurio.
    formElements = wayfDocument.select("form");
    for (Element formElement : formElements) {
        if (formElement.attr("id").equals("IdPList")) {
            wayfActionPath = formElement.attr("action");
        }
    }

    loginButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            // Obtm a URL correspondente ao idP selecionado no spinner.
            int selectedIdpPosition = idpSpinner.getSelectedItemPosition();
            Element selectedIdp = idpElements.get(selectedIdpPosition);
            selectedIdpUrl = selectedIdp.attr("value");

            try {
                // Obtm os campos "username" e "password" fornecidos
                // pelo usurio e necessrios para a autenticao.
                String username = usernameTxt.getText().toString();
                String password = passwordTxt.getText().toString();

                // Cria um novo objeto Connection, e adiciona o 
                // cookie passado pela Activity anterior.
                Connection connection = new Connection();
                BasicClientCookie newCookie = new BasicClientCookie(receivedCookie.getName(),
                        receivedCookie.getValue());
                newCookie.setDomain(receivedCookie.getDomain());
                connection.addCookie(newCookie);

                // Tenta realizar a autenticao no IdP selecionado. O resultado corresponde
                //  pgina para a qual o cliente  redirecionado em caso de autenticao 
                // bem-sucedida.
                String authResult = connection.authenticate(wayfLocation, wayfActionPath, selectedIdpUrl,
                        username, password);

                // Apenas mostra o recurso que o usurio queria acessar (neste caso, mostra a pg. de
                // "Homologao de atributos").
                Intent newIntent = new Intent(ShibAuthenticationActivity.this.getApplicationContext(),
                        TestActivity.class);
                Bundle bundle = new Bundle();
                bundle.putString("arg", authResult);
                newIntent.putExtras(bundle);
                startActivity(newIntent);

            } catch (IOException e) {
                String message = "IOException - problema na conexo";
                Toast toast = Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG);
                toast.show();
            } catch (Exception e) {
                String message = "Exception - problema na autenticao";
                Toast toast = Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG);
                toast.show();
            }
        }
    });

    backButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            finish();
        }
    });

}

From source file:com.cloudbees.gasp.activity.GaspRESTLoaderActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Set main content view for Gasp! Reviews
    setContentView(R.layout.gasp_review_activity);

    // Use the Fragments API to display review data
    FragmentManager fm = getFragmentManager();
    ListFragment list = (ListFragment) fm.findFragmentById(R.id.gasp_review_content);
    if (list == null) {
        list = new ListFragment();
        FragmentTransaction ft = fm.beginTransaction();
        ft.add(R.id.gasp_review_content, list);
        ft.commit();//from  ww  w  .  j  a v a 2s .c om
    }

    // Array adapter provides access to the review list data
    mAdapter = new ArrayAdapter<String>(this, R.layout.gasp_review_list);
    list.setListAdapter(mAdapter);

    // Load shared preferences from res/xml/preferences.xml (first time only)
    // Subsequent activations will use the saved shared preferences from the device
    PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
    SharedPreferences gaspSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);

    Log.i(TAG, "Using Gasp Server URI: " + gaspSharedPreferences.getString("gasp_endpoint_uri", ""));
    Uri gaspReviewsUri = Uri.parse(gaspSharedPreferences.getString("gasp_endpoint_uri", ""));

    // Loader arguments: LoaderManager will maintain the state of our Loaders
    // and reload if necessary. 
    Bundle args = new Bundle();
    Bundle params = new Bundle();
    args.putParcelable(ARGS_URI, gaspReviewsUri);
    args.putParcelable(ARGS_PARAMS, params);

    // Initialize the Loader.
    getLoaderManager().initLoader(LOADER_GASP_REVIEWS, args, this);

    // Use gasp-mongo REST service
    new ReviewsRequest().execute();

    try {
        LocationsRequest locations = new LocationsRequest(
                new SpatialQuery(new Location(-122.1139858, 37.3774655), 0.005));

        List<GeoLocation> locationList = locations.execute().get();
        for (GeoLocation geoLocation : locationList) {
            Log.i(TAG, geoLocation.getName());
            Log.i(TAG, " " + geoLocation.getFormattedAddress());
            Log.i(TAG, " " + String.valueOf(geoLocation.getLocation().getLng()));
            Log.i(TAG, " " + String.valueOf(geoLocation.getLocation().getLat()));
        }
    } catch (Exception e) {
        Log.e(TAG, e.getLocalizedMessage());
    }
}

From source file:com.nextgis.maplibui.formcontrol.Combobox.java

@Override
public void init(JSONObject element, List<Field> fields, Bundle savedState, Cursor featureCursor,
        SharedPreferences preferences) throws JSONException {

    JSONObject attributes = element.getJSONObject(JSON_ATTRIBUTES_KEY);
    mFieldName = attributes.getString(JSON_FIELD_NAME_KEY);
    mIsShowLast = ControlHelper.isSaveLastValue(attributes);
    setEnabled(ControlHelper.isEnabled(fields, mFieldName));

    String lastValue = null;// w ww .  j a v a2 s  .c om
    if (ControlHelper.hasKey(savedState, mFieldName))
        lastValue = savedState.getString(ControlHelper.getSavedStateKey(mFieldName));
    else if (null != featureCursor) {
        int column = featureCursor.getColumnIndex(mFieldName);
        if (column >= 0)
            lastValue = featureCursor.getString(column);
    } else if (mIsShowLast)
        lastValue = preferences.getString(mFieldName, null);

    int defaultPosition = 0;
    int lastValuePosition = -1;
    mAliasValueMap = new HashMap<>();

    ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<>(getContext(), R.layout.formtemplate_spinner);
    setAdapter(spinnerArrayAdapter);

    if (attributes.has(ConstantsUI.JSON_NGW_ID_KEY) && attributes.getLong(ConstantsUI.JSON_NGW_ID_KEY) != -1) {
        MapContentProviderHelper map = (MapContentProviderHelper) MapBase.getInstance();
        if (null == map)
            throw new IllegalArgumentException("The map should extends MapContentProviderHelper or inherited");

        String account = element.optString(SyncStateContract.Columns.ACCOUNT_NAME);
        long id = attributes.getLong(JSON_NGW_ID_KEY);
        for (int i = 0; i < map.getLayerCount(); i++) {
            if (map.getLayer(i) instanceof NGWLookupTable) {
                NGWLookupTable table = (NGWLookupTable) map.getLayer(i);
                if (table.getRemoteId() != id || !table.getAccountName().equals(account))
                    continue;

                int j = 0;
                for (Map.Entry<String, String> entry : table.getData().entrySet()) {
                    mAliasValueMap.put(entry.getValue(), entry.getKey());

                    if (null != lastValue && lastValue.equals(entry.getKey()))
                        lastValuePosition = j;

                    spinnerArrayAdapter.add(entry.getValue());
                    j++;
                }

                break;
            }
        }
    } else {
        JSONArray values = attributes.optJSONArray(JSON_VALUES_KEY);
        if (values != null) {
            for (int j = 0; j < values.length(); j++) {
                JSONObject keyValue = values.getJSONObject(j);
                String value = keyValue.getString(JSON_VALUE_NAME_KEY);
                String value_alias = keyValue.getString(JSON_VALUE_ALIAS_KEY);

                if (keyValue.has(JSON_DEFAULT_KEY) && keyValue.getBoolean(JSON_DEFAULT_KEY))
                    defaultPosition = j;

                if (null != lastValue && lastValue.equals(value))
                    lastValuePosition = j;

                mAliasValueMap.put(value_alias, value);
                spinnerArrayAdapter.add(value_alias);
            }
        }
    }

    setSelection(lastValuePosition >= 0 ? lastValuePosition : defaultPosition);

    // The drop down view
    spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    float minHeight = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 14,
            getResources().getDisplayMetrics());
    setPadding(0, (int) minHeight, 0, (int) minHeight);
}

From source file:com.example.yudiandrean.socioblood.Register.java

/**
 * Called when the activity is first created.
 *///from www.  j a va  2s. c  om
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.register);

    /**
     * Defining all layout items
     **/
    inputFirstName = (EditText) findViewById(R.id.firstname);
    inputLastName = (EditText) findViewById(R.id.lastname);
    inputUsername = (EditText) findViewById(R.id.username);
    inputEmail = (EditText) findViewById(R.id.email);
    inputPassword = (EditText) findViewById(R.id.password);
    btnRegister = (Button) findViewById(R.id.register);
    registerErrorMsg = (TextView) findViewById(R.id.register_error);

    //Blood type spinner
    inputBloodType = (Spinner) findViewById(R.id.bloodtype_spinner);

    ArrayAdapter<String> bloodadapter = new ArrayAdapter<String>(Register.this,
            android.R.layout.simple_spinner_dropdown_item) {
        @Override
        public View getView(int position, View convertView, ViewGroup parent) {

            View v = super.getView(position, convertView, parent);
            if (position == getCount()) {
                ((TextView) v.findViewById(android.R.id.text1)).setText("");
                ((TextView) v.findViewById(android.R.id.text1)).setHint(getItem(getCount())); //"Hint to be displayed"
            }
            return v;
        }

        @Override
        public int getCount() {
            return super.getCount() - 1; // you dont display last item. It is used as hint.
        }
    };

    bloodadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    bloodadapter.add("O");
    bloodadapter.add("A");
    bloodadapter.add("B");
    bloodadapter.add("AB");
    bloodadapter.add("Blood Type");
    inputBloodType.setAdapter(bloodadapter);
    inputBloodType.setSelection(bloodadapter.getCount()); //display hint

    //Rhesus spinner
    inputRhesus = (Spinner) findViewById(R.id.rhesus_spinner);
    ArrayAdapter<String> rhesusadapter = new ArrayAdapter<String>(Register.this,
            android.R.layout.simple_spinner_dropdown_item) {

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {

            View v = super.getView(position, convertView, parent);
            if (position == getCount()) {
                ((TextView) v.findViewById(android.R.id.text1)).setText("");
                ((TextView) v.findViewById(android.R.id.text1)).setHint(getItem(getCount())); //"Hint to be displayed"
            }

            return v;
        }

        @Override
        public int getCount() {
            return super.getCount() - 1; // you dont display last item. It is used as hint.
        }

    };

    rhesusadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    rhesusadapter.add("+");
    rhesusadapter.add("-");
    rhesusadapter.add("Rhesus");

    inputRhesus.setAdapter(rhesusadapter);
    inputRhesus.setSelection(rhesusadapter.getCount()); //display hint

    inputGender = (Spinner) findViewById(R.id.gender_spinner);
    ArrayAdapter<String> genderadapter = new ArrayAdapter<String>(Register.this,
            android.R.layout.simple_spinner_dropdown_item) {

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {

            View v = super.getView(position, convertView, parent);
            if (position == getCount()) {
                ((TextView) v.findViewById(android.R.id.text1)).setText("");
                ((TextView) v.findViewById(android.R.id.text1)).setHint(getItem(getCount())); //"Hint to be displayed"
            }

            return v;
        }

        @Override
        public int getCount() {
            return super.getCount() - 1; // you dont display last item. It is used as hint.
        }

    };

    genderadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    genderadapter.add("Male");
    genderadapter.add("Female");
    genderadapter.add("Gender");

    inputGender.setAdapter(genderadapter);
    inputGender.setSelection(genderadapter.getCount()); //display hint

    /**
     * Gets spinner value
     */

    // Session manager
    session = new SessionManager(getApplicationContext());

    // Check if user is already logged in or not
    if (session.isLoggedIn()) {
        // User is already logged in. Take him to main activity
        Intent intent = new Intent(Register.this, UserPanel.class);
        startActivity(intent);
        finish();
    }

    /**
     * Button which Switches back to the login screen on clicked
     **/

    login = (Button) findViewById(R.id.bktologin);
    login.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            Intent myIntent = new Intent(view.getContext(), LoginActivity.class);
            startActivityForResult(myIntent, 0);
            finish();
        }

    });

    /**
     * Register Button click event.
     * A Toast is set to alert when the fields are empty.
     * Another toast is set to alert Username must be 5 characters.
     **/

    btnRegister.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {

            if ((!inputUsername.getText().toString().equals(""))
                    && (!inputPassword.getText().toString().equals(""))
                    && (!inputFirstName.getText().toString().equals(""))
                    && (!inputLastName.getText().toString().equals(""))
                    && (!inputEmail.getText().toString().equals(""))
                    && (!inputBloodType.getSelectedItem().toString().equals(""))
                    && (!inputRhesus.getSelectedItem().toString().equals(""))
                    && (!inputGender.getSelectedItem().toString().equals(""))) {
                if (inputUsername.getText().toString().length() > 4) {
                    NetAsync(view);

                } else {
                    Toast.makeText(getApplicationContext(), "Username must be a minimum of 5 characters",
                            Toast.LENGTH_SHORT).show();
                }
            }

            else {
                Toast.makeText(getApplicationContext(), "One or more fields are empty", Toast.LENGTH_SHORT)
                        .show();
            }
        }
    });
}

From source file:com.tassadar.multirommgr.installfragment.InstallCard.java

@Override
public View getCardContent(Context context) {
    m_view = LayoutInflater.from(context).inflate(R.layout.install_card, null);

    Resources res = m_view.getResources();

    CheckBox b = (CheckBox) m_view.findViewById(R.id.install_multirom);
    b.setText(res.getString(R.string.install_multirom, m_manifest.getMultiromVersion()));
    b.setChecked(m_manifest.hasMultiromUpdate());
    b.setOnCheckedChangeListener(this);

    b = (CheckBox) m_view.findViewById(R.id.install_recovery);
    if (m_manifest.getRecoveryFile() != null) {
        final Date rec_date = m_manifest.getRecoveryVersion();
        final String recovery_ver = Recovery.DISPLAY_FMT.format(rec_date);
        b.setText(res.getString(R.string.install_recovery, recovery_ver));
        b.setChecked(m_manifest.hasRecoveryUpdate());
        b.setOnCheckedChangeListener(this);

        // Force user to install recovery if not yet installed - it is needed to flash ZIPs
        if (m_manifest.hasRecoveryUpdate() && m_forceRecovery) {
            b.append(Html.fromHtml(res.getString(R.string.required)));
            b.setClickable(false);/*from w  w  w .  ja va  2 s .c o m*/
        }
    } else {
        b.setChecked(false);
        b.setVisibility(View.GONE);
    }

    ArrayAdapter<String> adapter = new ArrayAdapter<String>(context,
            android.R.layout.simple_spinner_dropdown_item);
    adapter.addAll(m_manifest.getKernels().keySet());
    Spinner s = (Spinner) m_view.findViewById(R.id.kernel_options);
    s.setAdapter(adapter);
    s.setEnabled(false);
    s.setSelection(getDefaultKernel());

    b = (CheckBox) m_view.findViewById(R.id.install_kernel);
    b.setOnCheckedChangeListener(this);
    b.setEnabled(!adapter.isEmpty());
    b.setChecked(!adapter.isEmpty() && m_manifest.hasKernelUpdate());

    Button install_btn = (Button) m_view.findViewById(R.id.install_btn);
    install_btn.setOnClickListener(this);

    ImageButton changelog_btn = (ImageButton) m_view.findViewById(R.id.changelog_btn);
    if (m_manifest.getChangelogs() == null || m_manifest.getChangelogs().length == 0)
        changelog_btn.setVisibility(View.GONE);
    else
        changelog_btn.setOnClickListener(this);

    if (m_savedState != null)
        restoreInstanceState();

    enableInstallBtn();
    return m_view;
}

From source file:org.teleal.cling.android.browser.MainActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    // identity =
    // getIntent().getExtras().getString(ContentActivity.DEVICE_UUID);

    deviceListAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1);
    listview = getListView();//from  w  w  w.j a va2s  . com
    switchToDeviceList();

    getApplicationContext().bindService(new Intent(this, BrowserUpnpService.class), serviceConnection,
            Context.BIND_AUTO_CREATE);
}