在学习Android编写样例时由于失误,将name打成了maem,然后自动导入了android.R.attr.name,很显然出现了错误。在我输入用户名welkim后,显示的用户名为16842755这一串数字,好奇之心寻找了问题出现原因。从API文档中发现这似乎是一个常量。public static final int name
Added in API level 1A unique name for the given item. This must use a java-style naming convention to ensure the name is unique, for example "com.mycompany.MyName".
Must be a string value, using '//;' to escape characters such as '//n' or '//uxxxx' for a unicode character.
This may also be a reference to a resource (in the form "
Constant Value: 16842755 (0x01010003)@[package:]type:name") or theme attribute (in the form "?[package:][type:]name") containing a value of this type.import static android.R.attr.name;public class ActivityTwo extends AppCompatActivity { PRivate TextView tv_name; private TextView tv_passWord; private TextView tv_sex; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_02); Intent intent=getIntent(); String name=intent.getStringExtra("name"); String password=intent.getStringExtra("password"); String sex=intent.getStringExtra("sex"); tv_name=(TextView) findViewById(R.id.tv_name); tv_password=(TextView) findViewById(R.id.tv_password); tv_sex=(TextView) findViewById(R.id.tv_sex); tv_name.setText("用户名:"+name); tv_password.setText("密码:"+password); tv_sex.setText("性别:"+sex); }
新闻热点
疑难解答