실행환경

 Desktop

 조립식

 CPU

 Intel(R) Core(TM) i7-3770 3.50GHz

 Memory

 4 GB

 OS

 Window 7 Professional 32bit

 Java

 1.7.0_51

 Android

 SDK : 4.4.2 (KitKat) / 테스트기기 : Galaxy S3 4.3(Jelly Bean)

 WebServer

 Apache Tomcat 7.0

 DB

 MySQL 5.6.15


src/MenuCheck.java
import android.os.Bundle;
import android.app.Activity;
import android.util.*;
import android.view.*;
import android.widget.*;

public class Menucheck extends Activity {
	TextView mText;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.menucheck);
		mText = (TextView) findViewById(R.id.textsize);

	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.menucheck, menu);
		return true;
	}

	public boolean onPrepareOptionsMenu(Menu menu) {
		if (mText.getTextSize() >= 80) {
			menu.findItem(R.id.bigsize).setChecked(true);
		} else {
			menu.findItem(R.id.bigsize).setChecked(false);
		}
		String sex = (String) mText.getText();

		if (sex.equals("MAN")) {
			menu.findItem(R.id.man).setChecked(true);
		}
		if (sex.equals("GIRL")) {
			menu.findItem(R.id.girl).setChecked(true);
		}
		return true;
	}

	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		case R.id.bigsize:
			Log.v("Test1", "F" + mText.getTextSize());
			if (item.isChecked()) {
				mText.setTextSize(20);
			} else {
				mText.setTextSize(40);
			}
			Log.v("Test1", "L" + mText.getTextSize());
			return true;
		case R.id.man:
			mText.setText("MAN");
			return true;
		case R.id.girl:
			mText.setText("GIRL");
			return true;
		
		}
		return false;
	}
}
layout/menucheck.xml

    

    


menu/menucheck.xml


    
        
    

    
        
            
                
                
            
        
    


 


 


 


+ Recent posts