我正在做一个词汇,以说明我如何处理屏幕定位。 简单的反省是,当用户要求加固顿语和反面语时,就增加了计算量。 我的守则包括以下文字:混凝土机=“键盘板H iddentoration”,也转载于ConfigurationChanged方法。 但不幸的是,我无法保持计票的价值,当我把 em子转向地貌景观时,我是如何处理这个问题的?
public class Counter_demoActivity extends Activity {
int count=0;
TextView tv;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//UIActivity();
Button add1=(Button)findViewById(R.id.btn1);
Button sub1=(Button)findViewById(R.id.btn2);
tv=(TextView)findViewById(R.id.tv1);
add1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
count++;
tv.setText("Your Count is " + count);
iii
iii);
sub1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
count--;
tv.setText("Your Count is " +count);
iii
iii);
iii
@Override
public void onConfigurationChanged(Configuration newConfig) {
// TODO Auto-generated method stub
super.onConfigurationChanged(newConfig);
setContentView(R.layout.main);
//UIActivity();
iii
/*public void UIActivity(){
this.tv=(TextView)this.findViewById(R.id.tv1);
this.count=getChangingConfigurations();
iii*/
iii
我的明确档案:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.arif.counter_demo"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="14" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
>
<activity
android:label="@string/app_name"
android:name=".Counter_demoActivity"
android:configChanges="keyboardHidden|orientation|keyboard" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>