public class MyReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String temp_msg=intent.getStringExtra("msg");
Log.i("MSG--------------------------",temp_msg);
Toast.makeText(context, temp_msg, Toast.LENGTH_LONG).show();
}
}
问题:
上面的程序我DEBUG跟踪了:temp_msg能够正确赋值是中文的,
Toast.makeText(context, temp_msg, Toast.LENGTH_LONG).show();,也显示的中文正常,
但是Log.i("MSG--------------------------",temp_msg);这句话在LogCat里面显示的是乱码,我的工程编码是UTF-8.
是什么原因?