刘耕辰

刘耕辰的笔记

来自Android开发视频教程6(1)

Intent intent = getIntent()intent.getStringExtra();覆盖方法-添加菜单(当客户点击menu按钮的时候调用)public boolean onCreateOptionsMenu(Menu menu) {        menu.add(groupId, itemId, order, title)        return super.onCreateOptionsMenu(menu);    }点击菜单项时public boolean onOptionsItemSelected(MenuItem item) {        if(item.getItemId()=1){                    }        return super.onOptionsItemSelected(item);    }

来自Android开发视频教程5(0)

package com.example.activitydemo;import android.app.Activity;import android.content.Intent;import android.os.Bundle;import android.view.View;import android.view.View.OnClickListener;import android.widget.Button;public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button mybutton = (Button)findViewById(R.id.button_next); mybutton.setOnClickListener(new button_next()); } class button_next implements OnClickListener {@Override public void onClick(View v) { // TODO Auto-generated method stub Intent Intent = new Intent(); Intent.setClass(MainActivity.this, Activity_next.class); MainActivity.this.startService(Intent); } }}