編輯:關於Android編程
public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LinearLayout ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); this.setContentView(ll); TextView tv = new TextView(this); tv.setText("Activity為: " + this.toString() + "\n" + ", Task ID 為:" + this.getTaskId()); Button button = new Button(this); button.setText("啟動Activity"); ll.addView(tv); ll.addView(button); button.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, MainActivity.class); startActivity(intent); } } ); } }
public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LinearLayout ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); this.setContentView(ll); TextView tv = new TextView(this); tv.setText("Activity為: " + this.toString() + "\n" + ", Task ID 為:" + this.getTaskId()); Button button = new Button(this); button.setText("啟動Activity"); ll.addView(tv); ll.addView(button); button.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, SecondActivity.class); startActivity(intent); } } ); } } public class SecondActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LinearLayout ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); this.setContentView(ll); TextView tv = new TextView(this); tv.setText("Activity為: " + this.toString() + "\n" + ", Task ID 為:" + this.getTaskId()); Button button = new Button(this); button.setText("啟動Activity"); ll.addView(tv); ll.addView(button); button.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(SecondActivity.this,MainActivity.class); startActivity(intent); } } ); } }
public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LinearLayout ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); this.setContentView(ll); TextView tv = new TextView(this); tv.setText("Activity為: " + this.toString() + "\n" + ", Task ID 為:" + this.getTaskId()); Button button = new Button(this); button.setText("啟動Activity"); ll.addView(tv); ll.addView(button); button.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, SecondActivity.class); startActivity(intent); } } ); } } public class SecondActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LinearLayout ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); this.setContentView(ll); TextView tv = new TextView(this); tv.setText("Activity為: " + this.toString() + "\n" + ", Task ID 為:" + this.getTaskId()); Button button = new Button(this); button.setText("啟動Activity"); ll.addView(tv); ll.addView(button); button.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(); intent.setAction("org.crazyit.intent.action.CRAZYIT_ACTION"); startActivity(intent); } } ); } }
0x00 序隨著移動安全越來越火,各種調試工具也都層出不窮,但因為環境和需求的不同,並沒有工具是萬能的。另外工具是死的,人是活的,如果能搞懂工具的原理再結合上自身的經驗,
藍牙模塊(HC-06): private BluetoothAdapter mBtAdapter = BluetoothAdapter.getDefaultAdapter
有時候用Eclipse想按住ctrl鍵查看源碼怎麼辦? 下面具體步驟讓你輕松看源碼: 點擊android.jar下面的source: 這裡可以添加zip和文件夾,zi
最近也是剛好項目用到,於是就動手寫了一個Android 圖片選擇器的庫。支持圖庫多選/單選/圖片裁剪/拍照/自定義圖片加載庫,極大程度的簡化使用。截圖優點1、通過實現Im