开发者

error when saving a java file ( Some characters can not be mapped using Cp1252 character encoding)

开发者 https://www.devze.com 2023-01-22 00:59 出处:网络
When I am tring to save a java file, an error occured and and I can not save the file. Error is : \"Some characters can not be mapped using Cp1252 character encoding.\"

When I am tring to save a java file, an error occured and and I can not save the file.

Error is :

"Some characters can not be mapped using Cp1252 character encoding."

My Code is :

package org.anddev.android.HelloWorld;

    import android.app.Activity;
import android.content.SharedPreferences; 
    import android.os.Bundle; 
import android.text.Editable; 
import android.text.TextWatcher; 
import android.view.View; 
import android.view.View.OnClickListener; 
import android.widget.*; 

public class LifeCycleDemo extends Activity 
{ 
LinearLayout myScreen; 
TextView txtColorSelect; 
int actMode = 0; 

@Override 
public void onCreate(Bundle savedInstanceState)
{ 

        super.onCreate(savedInstanceState); 
        setContentView(R.layout.lifecycledemo); 
        myScreen = (LinearLayout) findViewById(R.id.myScreen); 
        TextView txtToDo = (TextView) findViewById(R.id.txtToDo); 

        Str开发者_StackOverflow社区ing msg = 

        "Instructions: \n" + "0. New instance (onCreate, onStart, onResume) \n" + 
        "1. Back Arrow (onPause, onStop, onDestroy) \n" + "2. Finish (onPause, onStop, onDestroy) \n" + "3. Home (onPause, onStop) \n" + "4. After 3 > App Tab > re-execute current app \n" 
        + " (onRestart, onStart, onResume) \n" + "5. Run DDMS > Receive a phone call or SMS \n" 
        + " (onRestart, onStart, onResume) \n" + "6. Enter some data - repeat steps 1-5 \n"; 

        txtToDo.setText(msg);
}

    @Override 
protected void onPause() 
{ 
     super.onPause(); 
    //saveDataFromCurrentState(); 
        Toast.makeText(this, "onPause", 1).show(); 
}

@Override 
protected void onRestart() 
{ 
        super.onRestart(); 
        Toast.makeText(
        this, "onRestart", 1).show(); 
}

@Override 
protected void onResume()
{ 
        super.onResume(); 
        Toast.makeText(
        this, "onResume", 1).show(); 
}

@Override 
protected void onStart()
{ 
        // TODO Auto-generated method stub 
        super.onStart(); 
        //updateFromSavedState(); 
        Toast.makeText(this, "onStart", 1).show(); 
}

@Override 
protected void onDestroy()
{ 
        // TODO Auto-generated method stub 
        super.onDestroy();
        Toast.makeText(this, "onDestroy", 1).show(); 
}

@Override 
protected void onStop() 
{ 
        // TODO Auto-generated method stub 
        super.onStop(); 
        Toast.makeText(this, "onStop", 1).show(); 
}

Please help me,...  


I think this means your editor is saving the file in CP1252 or WINDOWS-1252 character set. I think Java uses UTF-8. Try a different editor.

0

精彩评论

暂无评论...
验证码 换一张
取 消