方法展示
-
Markdown Extra 定义列表语法:
1、弹窗
-
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("提示");
builder.setMessage("asdddddddddd");
builder.create().show();
2、跳转至指定窗体
-
Intent intent = new Intent();
intent.setClass(context, class1);
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
intent.putExtra("id",111);
context.startActivity(intent);
3、为按钮注册事件 -
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btn_test = (Button) findViewById(R.id.bt_test);
btn_test.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
toActivity(MainActivity.this,Page2.class);
}
});
}
@Override
public void onClick(View v) {
btn_test_onClick();
}
4、开始一个线程 -
new Thread() {
@Override
public void run() {
final Bitmap bitmap = getHttpBitmap(item.images.medium);
((Activity) context).runOnUiThread(new Runnable() {
@Override
public void run() {
imgView.setImageBitmap(bitmap);
}
});
}
}.start();