Take the 2-minute tour ×
Code Review Stack Exchange is a question and answer site for peer programmer code reviews. It's 100% free, no registration required.

I have created circle with words but it work to slow. Here code of drawing this circle:

private final float STEP = 180f / 31f;
public final int TEXTVIEW_COUNT = 62;
private final float PI = (float) Math.PI;

private Context context;
private int textHeight;

public AngleCoordsLists(Context context, int textHeight) {
    this.context = context;
    this.textHeight = textHeight;

public void drawTranslation(float radius, int textViewWidth,
        List<TextView> textviews, RelativeLayout wordsLayout,
        int wordsCount, List<String> wordList) {
    int diff = wordsCount - TEXTVIEW_COUNT;

    for (int i = 0; i < TEXTVIEW_COUNT; i++) {
        float angle = i * STEP;
        double x = radius + (radius - textViewWidth)
                * Math.cos((angle * PI) / 180);
        double y = radius + (radius - textViewWidth)
                * Math.sin((angle * PI) / 180);

        TextView word = new TextView(context);
        if (i < 31) {
        } else {
            word.setText(wordList.get(i + diff));
        RotateAnimation rotateAnimation = new RotateAnimation(0, angle, 0,
                (float) (textHeight * 0.9));

        word.setPadding(10, 10, 10, 10);

        RelativeLayout.LayoutParams layoutparams = new RelativeLayout.LayoutParams(
                LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
        layoutparams.leftMargin = (int) Math.round(x);

        layoutparams.topMargin = (int) (Math.round(y - textHeight * 0.9));

        wordsLayout.addView(word, layoutparams);

And I have one more question: If I want to change all words on this circle(set another wordlist) how I can I do it with the least cost?

share|improve this question

closed as off-topic by Jamal Dec 16 '13 at 3:24

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking for code to be written to solve a specific problem are off-topic here as there is no code to review." – Jamal
If this question can be reworded to fit the rules in the help center, please edit the question.

Which class does AngleCoordsLists extend? When (and how often) is drawTranslation method called? And what exactly is too slow, is it the initialization or the updating? And how slow is "too slow"? –  Simon André Forsberg Nov 22 '13 at 21:29

Browse other questions tagged or ask your own question.