Advertisement
Guest User

Untitled

a guest
Feb 7th, 2011
655
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.12 KB | None | 0 0
  1. package com.updatedpage;
  2. import android.app.Activity;
  3. import android.content.Context;
  4. import android.graphics.Canvas;
  5. import android.os.Bundle;
  6. import android.widget.TextView;
  7. import android.widget.Toast;
  8.  
  9. public class UpdatedPage extends Activity
  10. {
  11.     private int cnt=0;
  12.     @Override
  13.     public void onCreate(Bundle savedInstanceState) {
  14.         super.onCreate(savedInstanceState);
  15.         setContentView(R.layout.main);
  16.         Mytext m=new Mytext(this);
  17.         m.setText("asdfdjgsd");
  18.         setContentView(m);
  19.         Toast.makeText(this," height = "+m.getLineCount(),Toast.LENGTH_SHORT).show();
  20.         m.append("asdfa");
  21.         Toast.makeText(this," cnt = "+cnt,Toast.LENGTH_SHORT).show();
  22.       }
  23.     public class Mytext extends TextView
  24.     {
  25.         public Mytext(Context context) {
  26.             super(context);
  27.             // TODO Auto-generated constructor stub
  28.         }
  29.         @Override
  30.         public void onSizeChanged(int w,int h,int oldw,int oldh)
  31.         {
  32.             super.onSizeChanged(w, h, oldw, oldh);
  33.             cnt=this.getLineCount();
  34.             Toast.makeText(getContext(),"on size changed "+this.getLineHeight() ,Toast.LENGTH_SHORT).show();
  35.            
  36.         }
  37.        
  38.        
  39.     }  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement