I have an simple EditText
inside an Activity
and I want to create a Bitmap
Image from that EditText
and content of the EditText
. The Image
should look same as the EditText
and its content
.
Here is how I want the Image should look like
, though this is an EditText but I want a Bitmap which should look same as this. So, how can I achieve this? Any idea would be great.
This is my code,
public class EditTextPinchZoomActivity extends Activity {
EditText editText;
ImageView imageView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
imageView = (ImageView) findViewById(R.id.image_view);
editText = (EditText) findViewById(R.id.edit_text);
editText.buildDrawingCache();
}
public void myOnClick(View view) {
switch (view.getId()) {
case R.id.btn:
imageView.setImageBitmap(editText.getDrawingCache());
break;
default:
break;
}
}
}