Reputation: 53
Here is my code...
package com.bmc;
public class Details extends Activity
{
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.details);
EditText desc,sol;
/*
Some code here...........
*/ desc=(EditText) findViewById(R.id.editText_desc1);
sol=(EditText) findViewById(R.id.editText_sol);
desc.setEnabled(false);
sol.setEnabled(false);
sol.setClickable(false);
desc.setClickable(false);
}
}
Here sol becomes write protected but desc does not. Does anyone have a solution? Thanks.
Upvotes: 1
Views: 638
Reputation: 3676
Try this, the best way to do it from code. It will also restrict your keyboard to pop up for typing.
Actually it disabled you key stroke on that edittext
.
EditText desc = (EditText)findViewById(R.id.editText_desc1);
desc.setKeyListener(null);
EditText sol = (EditText)findViewById(R.id.editText_sol);
sol.setKeyListener(null);
Upvotes: 2
Reputation: 34544
Try this:
desc.setEnabled(false);
desc.setClickable(false);
desc.setFocusable(false);
sol.setEnabled(false);
sol.setClickable(false);
sol.setFocusable(false);
Let me know how it goes.
Also, more help here if needed.
Upvotes: 0