0

this maybe the simpliest question therein, but please be considerate for me.

I am researching some tutorial/s regarding how to wrap text inside a EditText and I think these links will help me a lot.

StackOverFlow Answer 1

StackOverFlow Answer 2

Now my question is, how can I incorporate that java class. As you see I am still a student and I have little experience on these extends. I've tried using instantiate (I am more prone on vb.net) and here is my code

private AutoResizeTextView autoResizeTextView;// instantiate

//and on my textview
txtCalc.setTextSize(autoResizeTextView);

it isnt working. Can you help me fix my declaration cause I am trying to create a calculator for my school project?

Thanks a lot for your time and effort

EDIT I dont know if I understand it correctly but this what I do on my layout

    <com.bracks.androidtest.AutoResizeTextView
    android:id="@+id/screen"
    android:layout_width="285dp"
    android:layout_height="54dp"
    android:layout_gravity="center"
    android:layout_marginTop="5dp"
    android:background="@drawable/box_border"
    android:clickable="false"
    android:enabled="false"
    android:gravity="center"
    android:longClickable="false"
    android:textColor="#333333"
    android:textSize="30dp" 
    />

Sir it isnt working. I dont know if that is because of the code

Community
  • 1
  • 1
Androyds
  • 67
  • 1
  • 11
  • It will be **much** better for you if you'll read any java book first (at least first 100-200 pages). We can explain you where is your mistakes, but it won't help you a lot. – Dmitry Zaytsev Aug 31 '12 at 06:44
  • Do you need just show autoresize text view or something else? Are You really trying to 'extend' it in java terms? – sandrstar Aug 31 '12 at 06:46
  • @biovamp I am grateful that you answer my question, but I got a huge problem. I am passing it tommorrow and I dont have enough time if I will search on the book. Thats why I am seeking for professional help (I dont mean to be rude) – Androyds Aug 31 '12 at 06:49
  • @sandrstar what I am trying to do is use those tutorial and incorporate it on my textview cause my textview is not wrapping and I dont want it to be scrollable – Androyds Aug 31 '12 at 06:51

1 Answers1

1

Hope you'll understand it:

First of all:

private AutoResizeTextView autoResizeTextView;// instantiate

you're not instantinated anything there. To create object you must call the constructor.

//and on my textview
txtCalc.setTextSize(autoResizeTextView);

Looks like your txtCalc should be AutoResizeTextView instead of TextView. Do not try this:

txtCalc = autoResizeTextView;

Instead change view type in your XML file (layout) from <TextView /> to <yourPackageName.AutoResizeTextView></yourPackageName.AutoResizeTextView>

Dmitry Zaytsev
  • 23,650
  • 14
  • 92
  • 146