Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.updatedpage;
- import android.app.Activity;
- import android.content.Context;
- import android.graphics.Canvas;
- import android.os.Bundle;
- import android.widget.TextView;
- import android.widget.Toast;
- public class UpdatedPage extends Activity
- {
- private int cnt=0;
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- Mytext m=new Mytext(this);
- m.setText("asdfdjgsd");
- setContentView(m);
- Toast.makeText(this," height = "+m.getLineCount(),Toast.LENGTH_SHORT).show();
- m.append("asdfa");
- Toast.makeText(this," cnt = "+cnt,Toast.LENGTH_SHORT).show();
- }
- public class Mytext extends TextView
- {
- public Mytext(Context context) {
- super(context);
- // TODO Auto-generated constructor stub
- }
- @Override
- public void onSizeChanged(int w,int h,int oldw,int oldh)
- {
- super.onSizeChanged(w, h, oldw, oldh);
- cnt=this.getLineCount();
- Toast.makeText(getContext(),"on size changed "+this.getLineHeight() ,Toast.LENGTH_SHORT).show();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement