I am only an occasional Android programmer and can't seem to find an answer to this one. I am guessing I set something up wrong. My app works fine in the emulator, but when I move to a device, the
t|e|x|t|l|o|o|k|s|l|i|k|e|t|h|i|s|
when I type. My code is as follows, its pretty simple at this point...
EditText in xml
<EditText
android:id="@+id/server_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="text" />
MainActivity.java
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final Button clickButton = (Button) findViewById(R.id.save_button);
final EditText serverUrl = (EditText)findViewById(R.id.server_url);
final EditText serverUsername = (EditText)findViewById(R.id.server_username);
final EditText serverPassword = (EditText)findViewById(R.id.server_password);
clickButton.setOnClickListener( new OnClickListener() {
@Override
public void onClick(View arg0) {
String url = serverUrl.getText().toString();
String username = serverUsername.getText().toString();
String password = serverPassword.getText().toString();
ContentValues values = new ContentValues();
values.put(CredentialsProvider.SERVERURL, url);
values.put(CredentialsProvider.USERNAME, username);
values.put(CredentialsProvider.PASSWORD, password);
getContentResolver().update(
CredentialsProvider.CONTENT_URI, values, null, null);
}
});
String URL = "content://com.dont.touch.jobus.rum/credentials/1";
Uri creds = Uri.parse(URL);
Cursor c =getContentResolver().query(creds, null, null, null, "username");
if (c.moveToPosition(0)) {
serverUrl.setText(c.getString(c.getColumnIndex( CredentialsProvider.SERVERURL)));
serverUsername.setText(c.getString(c.getColumnIndex( CredentialsProvider.USERNAME)));
serverPassword.setText(c.getString(c.getColumnIndex( CredentialsProvider.PASSWORD)));
} else {
ContentValues values = new ContentValues();
values.put(CredentialsProvider.SERVERURL,
"not configured");
values.put(CredentialsProvider.USERNAME,
"not configured");
values.put(CredentialsProvider.PASSWORD,
"not configured");
getContentResolver().insert(
CredentialsProvider.CONTENT_URI, values);
}
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
}
}