Example usage for android.widget TextView setText

List of usage examples for android.widget TextView setText

Introduction

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

Prototype

@android.view.RemotableViewMethod
public final void setText(@StringRes int resid) 

Source Link

Document

Sets the text to be displayed using a string resource identifier.

Usage

From source file:it.redturtle.mobile.apparpav.MeteogramAdapter.java

/**
 * DOUBLE IMAGE ROW/*w w  w . ja  v  a  2  s  .  c  o m*/
 * @param att
 * @param linear
 * @return
 */
public LinearLayout getDoubleImageRow(Map<String, String> att, LinearLayout linear) {

    LinearLayout container_layout = new LinearLayout(context);
    container_layout.setBackgroundDrawable(context.getResources().getDrawable(R.drawable.view_shape_meteo));
    container_layout.setMinimumHeight(46);
    container_layout.setVerticalGravity(Gravity.CENTER);

    LinearLayout.LayoutParams value_params = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,
            LayoutParams.WRAP_CONTENT, 0.3f);
    TextView tx = new TextView(context);
    tx.setText(att.get("title"));
    tx.setTextSize(11);
    tx.setTypeface(null, Typeface.BOLD);
    tx.setGravity(Gravity.LEFT);
    tx.setPadding(3, 0, 0, 2);
    tx.setTextColor(Color.rgb(66, 66, 66));
    container_layout.addView(tx, value_params);

    LinearLayout.LayoutParams value_one_params = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, 46,
            0.35f);
    ImageView img1 = new ImageView(context);
    String path = "it.redturtle.mobile.apparpav:drawable/" + FilenameUtils.removeExtension(att.get("value1"));
    img1.setImageResource(context.getResources().getIdentifier(path, null, null));
    img1.setPadding(0, 3, 0, 3);
    container_layout.addView(img1, value_one_params);

    LinearLayout.LayoutParams value_two_params = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, 46,
            0.35f);
    ImageView img2 = new ImageView(context);
    path = "it.redturtle.mobile.apparpav:drawable/" + FilenameUtils.removeExtension(att.get("value2"));
    img2.setImageResource(context.getResources().getIdentifier(path, null, null));
    img2.setPadding(0, 3, 0, 3);
    container_layout.addView(img2, value_two_params);

    linear.addView(container_layout);

    return linear;
}

From source file:org.mifos.androidclient.main.DepositDueDetailsActivity.java

private void updateContent(SavingsAccountDepositDue details) {
    mDetails = details;//from w  ww.  j  av a  2 s .  c  o  m
    TextView cell;
    Double nextDeposit, pastDepositAmount, pastDepositsSum = 0.0;

    cell = (TextView) findViewById(R.id.depositDueDetails_nextDeposit);
    nextDeposit = details.getNextDueDetail().getDueAmount();
    cell.setText(nextDeposit.toString());

    if (ValueUtils.hasElements(details.getPreviousDueDetails())) {
        TableLayout table = (TableLayout) findViewById(R.id.depositDueDetails_table);
        View view = findViewById(R.id.depositDueDetails_rowInsertPoint);
        int index = table.indexOfChild(view) + 1;
        view = findViewById(R.id.depositDueDetails_subTotal_label);
        TableLayoutHelper helper = new TableLayoutHelper(this,
                TableLayoutHelper.DEFAULT_TABLE_ROW_SEPARATOR_HEIGHT, view.getPaddingLeft(),
                view.getPaddingRight());

        for (DueOnDate pastDeposit : details.getPreviousDueDetails()) {
            if (pastDeposit.getDueDate().before(details.getNextDueDetail().getDueDate())) {
                TableRow row = helper.createTableRow();
                cell = helper.createTableCell(DateUtils.format(pastDeposit.getDueDate()), 1);
                row.addView(cell);
                pastDepositAmount = pastDeposit.getDueAmount();
                cell = helper.createTableCell(pastDepositAmount.toString(), 2);
                row.addView(cell);
                table.addView(row, index);
                index++;
                table.addView(helper.createRowSeparator(), index);
                index++;
                pastDepositsSum += pastDepositAmount;
            }
        }
    }

    cell = (TextView) findViewById(R.id.depositDueDetails_subTotal);
    cell.setText(pastDepositsSum.toString());
    cell = (TextView) findViewById(R.id.depositDueDetails_totalAmountDue_label);
    cell.setText(cell.getText() + DateUtils.format(details.getNextDueDetail().getDueDate()));
    cell = (TextView) findViewById(R.id.depositDueDetails_totalAmountDue);
    cell.setText(Double.toString(pastDepositsSum + nextDeposit));
}

From source file:asu.edu.msse.gpeddabu.moviedescriptions.MovieListAdapter.java

@Override
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView,
        ViewGroup parent) {//  w ww. j  a  v  a  2  s  . c o  m
    final String childText = (String) getChild(groupPosition, childPosition);
    if (convertView == null) {
        android.util.Log.d(this.getClass().getSimpleName(), "in getChildView null so creating new view");
        LayoutInflater inflater = (LayoutInflater) this.parent
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = inflater.inflate(R.layout.movie_list, null);
    }
    TextView txtListChild = (TextView) convertView.findViewById(R.id.movieTitle);
    convertView.setOnTouchListener(this);
    convertView.setBackgroundResource(R.color.light_blue);
    txtListChild.setText(childText);
    return convertView;

}

From source file:fm.smart.r1.CreateExampleActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ExceptionHandler.register(this);
    setContentView(R.layout.create_example);
    final Intent queryIntent = getIntent();
    Bundle extras = queryIntent.getExtras();
    item_id = (String) extras.get("item_id");
    goal_id = (String) extras.get("goal_id");
    if (goal_id == null || goal_id.equals("")) {
        goal_id = Main.default_study_goal_id;
    }//from   w  w  w .  j  a v  a 2s. co m

    cue = (String) extras.get("cue");
    example = (String) extras.get("example");
    translation = (String) extras.get("translation");
    example_language = (String) extras.get("example_language");
    translation_language = (String) extras.get("translation_language");
    example_transliteration = (String) extras.get("example_transliteration");
    translation_transliteration = (String) extras.get("translation_transliteration");

    TextView example_text = (TextView) findViewById(R.id.create_example_sentence);
    if (!TextUtils.isEmpty(example)) {
        example_text.setText(example);
    }
    example_text.setHint(example_language + " sentence with " + cue);
    TextView translation_text = (TextView) findViewById(R.id.create_example_translation);
    if (!TextUtils.isEmpty(translation)) {
        translation_text.setText(translation);
    }
    translation_text.setHint(translation_language + " translation of example sentence");

    Button button = (Button) findViewById(R.id.create_example_submit);
    button.setOnClickListener(this);

    TextView translation_text_legend = (TextView) findViewById(R.id.create_example_translation_legend);

    TextView sentence_transliteration_textView = (TextView) findViewById(
            R.id.create_example_sentence_transliteration);
    EditText sentence_transliteration_input_textView = (EditText) findViewById(R.id.sentence_transliteration);
    if (!Utils.isIdeographicLanguage(Main.search_lang)) {
        sentence_transliteration_textView.setVisibility(View.GONE);
        sentence_transliteration_input_textView.setVisibility(View.GONE);
    } else if (!TextUtils.isEmpty(example_transliteration)) {
        sentence_transliteration_input_textView.setText(example_transliteration);
    }

    TextView translation_transliteration_textView = (TextView) findViewById(
            R.id.create_example_translation_transliteration);
    EditText translation_transliteration_input_textView = (EditText) findViewById(
            R.id.translation_transliteration);
    if (!Utils.isIdeographicLanguage(Main.result_lang)) {
        translation_transliteration_textView.setVisibility(View.GONE);
        translation_transliteration_input_textView.setVisibility(View.GONE);
    } else if (!TextUtils.isEmpty(translation_transliteration)) {
        translation_transliteration_input_textView.setText(translation_transliteration);
    }

}

From source file:it.redturtle.mobile.apparpav.MeteogramAdapter.java

/**
 * DOUBLE TEXT ROW//from w w  w  .  ja  v a2  s  .c  o m
 * @param att
 * @param linear
 * @return
 */
public LinearLayout getDoubleTextRow(Map<String, String> att, LinearLayout linear) {

    LinearLayout container_layout = new LinearLayout(context);
    container_layout.setBackgroundDrawable(context.getResources().getDrawable(R.drawable.view_shape_meteo));
    container_layout.setMinimumHeight(46);
    container_layout.setVerticalGravity(Gravity.CENTER);

    LinearLayout.LayoutParams value_params = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,
            LayoutParams.WRAP_CONTENT, 0.3f);
    TextView tx = new TextView(context);
    tx.setText(att.get("title"));
    tx.setTextSize(11);
    tx.setTypeface(null, Typeface.BOLD);
    tx.setGravity(Gravity.LEFT);
    tx.setPadding(2, 0, 0, 2);
    tx.setTextColor(Color.rgb(66, 66, 66));
    container_layout.addView(tx, value_params);

    LinearLayout.LayoutParams value_one_params = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,
            LayoutParams.WRAP_CONTENT, 0.35f);
    TextView t1 = new TextView(context);
    t1.setText(att.get("value1").equals("") ? " - " : att.get("value1"));
    t1.setTextSize(11);
    t1.setGravity(Gravity.CENTER_HORIZONTAL);
    t1.setPadding(2, 0, 0, 2);
    t1.setTextColor(Color.rgb(66, 66, 66));
    container_layout.addView(t1, value_one_params);

    LinearLayout.LayoutParams value_two_params = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,
            LayoutParams.WRAP_CONTENT, 0.35f);
    TextView t2 = new TextView(context);
    t2.setTextSize(11);
    t2.setText(att.get("value2").equals("") ? " - " : att.get("value2"));
    t2.setGravity(Gravity.CENTER_HORIZONTAL);
    t2.setPadding(2, 0, 0, 2);
    t2.setTextColor(Color.rgb(66, 66, 66));
    container_layout.addView(t2, value_two_params);

    linear.addView(container_layout);

    return linear;
}

From source file:com.nttec.everychan.ui.ShareActivity.java

private void handleIntent(Intent intent) {
    ArrayAdapter<Pair<TabModel, SerializablePage>> adapter = new ArrayAdapter<Pair<TabModel, SerializablePage>>(
            this, 0) {
        private final int drawablePadding = (int) (getResources().getDisplayMetrics().density * 5 + 0.5f);

        @Override//from  w  w  w .java2s  .co  m
        public View getView(int position, View convertView, ViewGroup parent) {
            View view = convertView == null
                    ? getLayoutInflater().inflate(android.R.layout.simple_list_item_1, parent, false)
                    : convertView;
            TextView tv = (TextView) view.findViewById(android.R.id.text1);
            tv.setEllipsize(TextUtils.TruncateAt.END);
            tv.setSingleLine();
            tv.setText(getItem(position).getLeft().title);
            tv.setCompoundDrawablesWithIntrinsicBounds(MainApplication.getInstance()
                    .getChanModule(getItem(position).getLeft().pageModel.chanName).getChanFavicon(), null, null,
                    null);
            tv.setCompoundDrawablePadding(drawablePadding);
            return view;
        }
    };
    for (TabModel tab : MainApplication.getInstance().tabsState.tabsArray) {
        if (tab.type == TabModel.TYPE_NORMAL && tab.pageModel.type != UrlPageModel.TYPE_SEARCHPAGE) {
            SerializablePage page = MainApplication.getInstance().pagesCache.getSerializablePage(tab.hash);
            if (page != null) {
                adapter.add(Pair.of(tab, page));
            }
        }
    }
    if (adapter.getCount() == 0) {
        for (Database.HistoryEntry entity : MainApplication.getInstance().database.getHistory()) {
            try {
                TabModel tab = new TabModel();
                tab.title = entity.title;
                tab.type = TabModel.TYPE_NORMAL;
                tab.webUrl = entity.url;
                tab.pageModel = UrlHandler.getPageModel(entity.url);
                tab.hash = ChanModels.hashUrlPageModel(tab.pageModel);
                SerializablePage page = MainApplication.getInstance().pagesCache.getSerializablePage(tab.hash);
                if (page != null) {
                    adapter.add(Pair.of(tab, page));
                }
            } catch (Exception e) {
                Logger.e(TAG, e);
            }
        }
        if (adapter.getCount() == 0) {
            Toast.makeText(this, R.string.share_no_tabs, Toast.LENGTH_LONG).show();
            finish();
            return;
        }
    }
    if (PostingService.isNowPosting()) {
        Toast.makeText(this, R.string.posting_now_posting, Toast.LENGTH_LONG).show();
        finish();
        return;
    }
    selectedFile = null;
    if (intent != null) {
        Uri uri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
        if (uri != null) {
            File file = UriFileUtils.getFile(this, uri);
            if (file != null) {
                selectedFile = file;
            }
        }
    }
    if (selectedFile == null) {
        Toast.makeText(this, R.string.postform_cannot_attach, Toast.LENGTH_LONG).show();
        finish();
        return;
    }
    setListAdapter(adapter);
}

From source file:com.example.healthplus.wifidirect.DeviceDetailFragment.java

@Override
public void onConnectionInfoAvailable(final WifiP2pInfo info) {
    if (progressDialog != null && progressDialog.isShowing()) {
        progressDialog.dismiss();/*from www .j a v a 2  s .  c  o m*/
    }
    this.info = info;
    this.getView().setVisibility(View.VISIBLE);

    // The owner IP is now known.
    TextView view = (TextView) mContentView.findViewById(R.id.group_owner);
    view.setText(getResources().getString(R.string.group_owner_text)
            + ((info.isGroupOwner == true) ? getResources().getString(R.string.yes)
                    : getResources().getString(R.string.no)));

    // InetAddress from WifiP2pInfo struct.
    view = (TextView) mContentView.findViewById(R.id.device_info);
    view.setText("Group Owner IP - " + info.groupOwnerAddress.getHostAddress());

    mContentView.findViewById(R.id.btn_start_client).setVisibility(View.VISIBLE);

    if (!server_running) {
        new ServerAsyncTask(getActivity(), mContentView.findViewById(R.id.status_text)).execute();
        server_running = true;
    }

    // hide the connect button
    mContentView.findViewById(R.id.btn_connect).setVisibility(View.GONE);
}

From source file:edu.stanford.mobisocial.dungbeetle.model.DbObject.java

/**
 * @param v the view to bind//from  www. ja  v a2s. co m
 * @param context standard activity context
 * @param c the cursor source for the object in the db object table.
 * Must include _id in the projection.
 * 
 * @param allowInteractions controls whether the bound view is
 * allowed to intercept touch events and do its own processing.
 */
public static void bindView(View v, final Context context, Cursor cursor, boolean allowInteractions) {
    TextView nameText = (TextView) v.findViewById(R.id.name_text);
    ViewGroup frame = (ViewGroup) v.findViewById(R.id.object_content);
    frame.removeAllViews();

    // make sure we have all the columns we need
    Long objId = cursor.getLong(cursor.getColumnIndexOrThrow(DbObj.COL_ID));
    String[] projection = null;
    String selection = DbObj.COL_ID + " = ?";
    String[] selectionArgs = new String[] { Long.toString(objId) };
    String sortOrder = null;
    Cursor c = context.getContentResolver().query(DbObj.OBJ_URI, projection, selection, selectionArgs,
            sortOrder);
    if (!c.moveToFirst()) {
        Log.w(TAG, "could not find obj " + objId);
        c.close();
        return;
    }
    DbObj obj = App.instance().getMusubi().objForCursor(c);
    if (obj == null) {
        nameText.setText("Failed to access database.");
        Log.e("DbObject", "cursor was null for bindView of DbObject");
        return;
    }
    DbUser sender = obj.getSender();
    Long timestamp = c.getLong(c.getColumnIndexOrThrow(DbObj.COL_TIMESTAMP));
    Long hash = obj.getHash();
    short deleted = c.getShort(c.getColumnIndexOrThrow(DELETED));
    String feedName = obj.getFeedName();
    String type = obj.getType();
    Date date = new Date(timestamp);
    c.close();
    c = null;

    if (sender == null) {
        nameText.setText("Message from unknown contact.");
        return;
    }
    nameText.setText(sender.getName());

    final ImageView icon = (ImageView) v.findViewById(R.id.icon);
    if (sViewProfileAction == null) {
        sViewProfileAction = new OnClickViewProfile((Activity) context);
    }
    icon.setTag(sender.getLocalId());
    if (allowInteractions) {
        icon.setOnClickListener(sViewProfileAction);
        v.setTag(objId);
    }
    icon.setImageBitmap(sender.getPicture());

    if (deleted == 1) {
        v.setBackgroundColor(sDeletedColor);
    } else {
        v.setBackgroundColor(Color.TRANSPARENT);
    }

    TextView timeText = (TextView) v.findViewById(R.id.time_text);
    timeText.setText(RelativeDate.getRelativeDate(date));

    frame.setTag(objId); // TODO: error prone! This is database id
    frame.setTag(R.id.object_entry, cursor.getPosition()); // this is cursor id
    FeedRenderer renderer = DbObjects.getFeedRenderer(type);
    if (renderer != null) {
        renderer.render(context, frame, obj, allowInteractions);
    }

    if (!allowInteractions) {
        v.findViewById(R.id.obj_attachments_icon).setVisibility(View.GONE);
        v.findViewById(R.id.obj_attachments).setVisibility(View.GONE);
    } else {
        if (!MusubiBaseActivity.isDeveloperModeEnabled(context)) {
            v.findViewById(R.id.obj_attachments_icon).setVisibility(View.GONE);
            v.findViewById(R.id.obj_attachments).setVisibility(View.GONE);
        } else {
            ImageView attachmentCountButton = (ImageView) v.findViewById(R.id.obj_attachments_icon);
            TextView attachmentCountText = (TextView) v.findViewById(R.id.obj_attachments);
            attachmentCountButton.setVisibility(View.VISIBLE);

            if (hash == 0) {
                attachmentCountButton.setVisibility(View.GONE);
            } else {
                //int color = DbObject.colorFor(hash);
                boolean selfPost = false;
                DBHelper helper = new DBHelper(context);
                try {
                    Cursor attachments = obj.getSubfeed().query("type=?", new String[] { LikeObj.TYPE });
                    try {
                        attachmentCountText.setText("+" + attachments.getCount());

                        if (attachments.moveToFirst()) {
                            while (!attachments.isAfterLast()) {
                                if (attachments.getInt(attachments.getColumnIndex(CONTACT_ID)) == -666) {
                                    selfPost = true;
                                    break;
                                }
                                attachments.moveToNext();

                            }
                        }
                    } finally {
                        attachments.close();
                    }
                } finally {
                    helper.close();
                }
                if (selfPost) {
                    attachmentCountButton.setImageResource(R.drawable.ic_menu_love_red);
                } else {
                    attachmentCountButton.setImageResource(R.drawable.ic_menu_love);
                }
                attachmentCountText.setTag(R.id.object_entry, hash);
                attachmentCountText.setTag(R.id.feed_label, Feed.uriForName(feedName));
                attachmentCountText.setOnClickListener(LikeListener.getInstance(context));
            }
        }
    }
}

From source file:com.linkedin.android.eventsapp.EventFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final String eventNameArg = getArguments().getString(EXTRA_EVENT_NAME);
    final long eventDateArg = getArguments().getLong(EXTRA_EVENT_DATE);
    final String eventLocationArg = getArguments().getString(EXTRA_EVENT_LOCATION);
    int pictureIdArg = getArguments().getInt(EXTRA_PICTURE_ID);
    boolean isAttendingArg = getArguments().getBoolean(EXTRA_EVENT_ATTENDING);
    Person[] attendeesArg = (Person[]) getArguments().getParcelableArray(EXTRA_EVENT_ATTENDEES);

    SimpleDateFormat dateFormat = new SimpleDateFormat("E dd MMM yyyy 'at' hh:00 a");
    final String dateString = dateFormat.format(new Date(eventDateArg));

    View v = inflater.inflate(R.layout.layout_event_fragment, container, false);

    boolean accessTokenValid = LISessionManager.getInstance(getActivity()).getSession().isValid();
    if (!accessTokenValid) {
        ViewStub linkedinLogin = (ViewStub) v.findViewById(R.id.connectWithLinkedInStub);
        linkedinLogin.inflate();/*w  ww  . j  av  a2s . co  m*/

        Button loginButton = (Button) v.findViewById(R.id.connectWithLinkedInButton);
        loginButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Log.i(TAG, "clicked login button");
                LISessionManager.getInstance(getActivity()).init(getActivity(), Constants.scope,
                        new AuthListener() {
                            @Override
                            public void onAuthSuccess() {
                                Intent intent = new Intent(getActivity(), MainActivity.class);
                                startActivity(intent);
                                getActivity().finish();
                            }

                            @Override
                            public void onAuthError(LIAuthError error) {

                            }
                        }, false);
            }
        });
    }

    TextView eventNameView = (TextView) v.findViewById(R.id.eventName);
    eventNameView.setText(eventNameArg);

    TextView eventLocationAndDateView = (TextView) v.findViewById(R.id.eventLocationAndDate);
    eventLocationAndDateView.setText(eventLocationArg + "   " + dateString);

    TextView eventAttendeeCount = (TextView) v.findViewById(R.id.attendeeCount);
    eventAttendeeCount.setText("Other Attendees (" + attendeesArg.length + ")");

    ImageView eventImageView = (ImageView) v.findViewById(R.id.eventImage);
    eventImageView.setImageResource(pictureIdArg);

    final Button attendButton = (Button) v.findViewById(R.id.attendButton);
    final Button declineButton = (Button) v.findViewById(R.id.declineButton);

    if (isAttendingArg) {
        attendButton.setText("Attending");
        attendButton.setEnabled(false);

        declineButton.setText("Decline");
        declineButton.setEnabled(true);
    }

    attendButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ((Button) v).setText("Attending");
            v.setEnabled(false);
            declineButton.setText("Decline");
            declineButton.setEnabled(true);
            if (LISessionManager.getInstance(getActivity()).getSession().isValid()) {
                AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getActivity());
                alertDialogBuilder.setTitle("Share on LinkedIn?");
                alertDialogBuilder.setCancelable(true)
                        .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int id) {
                                JSONObject shareObject = new JSONObject();
                                try {
                                    JSONObject visibilityCode = new JSONObject();
                                    visibilityCode.put("code", "anyone");
                                    shareObject.put("visibility", visibilityCode);
                                    shareObject.put("comment", "I am attending " + eventNameArg + " in "
                                            + eventLocationArg + " on " + dateString);
                                } catch (JSONException e) {

                                }
                                APIHelper.getInstance(getActivity()).postRequest(getActivity(),
                                        Constants.shareBaseUrl, shareObject, new ApiListener() {
                                            @Override
                                            public void onApiSuccess(ApiResponse apiResponse) {
                                                Toast.makeText(getActivity(), "Your share was successful!",
                                                        Toast.LENGTH_LONG);
                                            }

                                            @Override
                                            public void onApiError(LIApiError apiError) {
                                                Log.e(TAG, apiError.toString());
                                                Toast.makeText(getActivity(),
                                                        "Your share was unsuccessful. Try again later!",
                                                        Toast.LENGTH_LONG);
                                            }
                                        });
                            }
                        }).setNegativeButton("No", new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int id) {
                                dialog.cancel();
                            }
                        });
                AlertDialog alertDialog = alertDialogBuilder.create();
                alertDialog.show();
            }
        }
    });

    declineButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ((Button) v).setText("Declined");
            v.setEnabled(false);
            attendButton.setText("Attend");
            attendButton.setEnabled(true);
        }
    });

    ListView attendeesListView = (ListView) v.findViewById(R.id.attendeesList);
    AttendeeAdapter adapter = new AttendeeAdapter(getActivity(), R.layout.attendee_list_item, attendeesArg,
            accessTokenValid);
    attendeesListView.setAdapter(adapter);
    attendeesListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            ArrayAdapter adapter = (ArrayAdapter) parent.getAdapter();
            Person person = (Person) adapter.getItem(position);

            Intent intent = new Intent(getActivity(), ProfileActivity.class);
            Bundle extras = new Bundle();
            extras.putParcelable("person", person);
            intent.putExtras(extras);
            startActivity(intent);
        }
    });
    return v;
}

From source file:org.openremote.android.console.util.AsyncResourceLoader.java

/**
 * Update progress message in text./*from  w  w w .  ja  v a 2s.  c  o m*/
 * 
 * @see android.os.AsyncTask#onProgressUpdate(Progress[])
 */
@Override
protected void onProgressUpdate(String... values) {
    RelativeLayout loadingView = (RelativeLayout) (activity.findViewById(R.id.welcome_view));
    if (loadingView == null) {
        return;
    }

    TextView loadingText = (TextView) (activity.findViewById(R.id.loading_text));
    loadingText.setText("loading " + values[0] + "...");
    loadingText.setEllipsize(TruncateAt.MIDDLE);
    loadingText.setSingleLine(true);
}