下面的input_latitude.getText().toString()跟input_longitude.getText().toString()
是我的EditText叫使用者輸入的

文章標籤

cookiesp 發表在 痞客邦 留言(0) 人氣()

要實作前請先看前置作業http://cookiesp.pixnet.net/blog/post/77243100

這個程式分了兩個java檔welcome.java跟GoogleMapActivity

文章標籤

cookiesp 發表在 痞客邦 留言(0) 人氣()

除了本身主要Activity的layout之外還要有一個要顯示在AlertDialog上的layout

在AlertDialog內的元件只能在
產生AlertDialog的時候findViewById 不然會FC 
PS:!!!! 如果你的AlertDialog所用的Layout裡
只有一個EditText 且 
EditText有加上<requestFocus />
那你的layout將會看不到... 我也不知道為什麼

文章標籤

cookiesp 發表在 痞客邦 留言(0) 人氣()

ZoomControls

這裡示範在地圖上googlemap

文章標籤

cookiesp 發表在 痞客邦 留言(0) 人氣()

step1:

在eclipse中window>preferences>Android>Build

文章標籤

cookiesp 發表在 痞客邦 留言(0) 人氣()

物件比對的時候 

==是比是不是同一物件(比hashcode)

文章標籤

cookiesp 發表在 痞客邦 留言(0) 人氣()


『亂數*( m - n + 1) + n 』用 -9 ~ -1代入

文章標籤

cookiesp 發表在 痞客邦 留言(0) 人氣()

public class calculateActivity extends Activity {
    
    private Spinner input_v;
    private final static String[] option_vs={"110V","220V"};//Spinner內要放的項目
    private ArrayAdapter adapter;
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);        
        
        input_v=(Spinner) findViewById(R.id.input_v);
        
        
        adapter=new ArrayAdapter(this,android.R.layout.simple_spinner_item,option_vs);
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        input_v.setAdapter(adapter);
        
    //如果要用到Spinner選取的項目用 input_v.getSelectedItem()  
 
    }
            
       
}

-------------------如果要監聽item選取事件-----------------------------------

unit_spinner.setOnItemSelectedListener(new Spinner.OnItemSelectedListener(){
                @Override
                public void onItemSelected(AdapterView arg0, View arg1,
                int which, long arg3) {
                
                        textview_unit.setText(unit_spinner.getSelectedItem().toString());
                
                }
                
                @Override
                public void onNothingSelected(AdapterView arg0) {
                }
                        
});

文章標籤

cookiesp 發表在 痞客邦 留言(0) 人氣()


StringBuffer sb = new StringBuffer(要處理的字串);

cookiesp 發表在 痞客邦 留言(0) 人氣()

getString(R.string.string裡的字串)


cookiesp 發表在 痞客邦 留言(0) 人氣()