I currently am working on an android app and up until now I used eclipse android emulator for testing it.
Today I have decided to try it on my phone (Xiaomi mi2) but when I lunch it (via usb debugging) I face 2 problems:
I have a background picture that the emulator show perfectly but it doesn't appear on my phone - a black background is shown.
Maybe this is the problem for the previous one, the LogCat shows some errors:
03-01 22:18:35.599: E/OpenGLRenderer(1109): Cannot generate texture from bitmap
03-01 22:18:35.629: E/SpannableStringBuilder(1109): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
Activity code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="480dip"
android:layout_marginTop="10dip"
android:background="@drawable/bg">
<EditText
android:id="@+id/eu_un"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPersonName"
android:hint="@string/enter_user_name" >
</EditText>
<EditText
android:id="@+id/eu_pw"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/eu_un"
android:ems="10"
android:hint="@string/enter_password"
android:inputType="textPassword|textPersonName" />
<Button
android:id="@+id/nu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="134dp"
android:text="@string/signup" />
<Button
android:id="@+id/eu_signin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/eu_pw"
android:layout_centerHorizontal="true"
android:text="@string/login" />
<Button
android:id="@+id/exit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/eu_signin"
android:layout_alignParentBottom="true"
android:layout_marginBottom="61dp"
android:text="@string/exit" />
</RelativeLayout>
Java code:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
un = (EditText) findViewById(R.id.eu_un);
pw = (EditText) findViewById(R.id.eu_pw);
nu = (Button) findViewById(R.id.nu);
eu = (Button) findViewById(R.id.eu_signin);
exit = (Button) findViewById(R.id.exit);
ma = this;
nu.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
newUser();
}
});
.java
file? – Phil Mar 1 '13 at 20:40