我有一个意图:
Intent myIntent = new Intent(this, MyActivity.class);
有一个与 MyActivity 相关的布局(带有按钮)。
如何删除或禁用 myIntent 中的按钮?
TIA
我有一个意图:
Intent myIntent = new Intent(this, MyActivity.class);
有一个与 MyActivity 相关的布局(带有按钮)。
如何删除或禁用 myIntent 中的按钮?
TIA
我大多是这样做的
Intent intent = new Intent(this, MyActivity.class);
Bundle msges = new Bundle();
msges.putString("disableTheBtn", "yes");
intent.putExtras(msges);
startActivity(intent);
在MyActivity 类里面
public void onCreate(Bundle savedInstanceState) {
---------Do some thing , Button and GUI initialization-------
try{
String disableTheBtn = getIntent().getExtras().getString("disableTheBtn"));
if (disableTheBtn != null && !disableTheBtn.isEmpty(){
yourBtn.setVisibilty(View.GONE);//hide that button
}
}catch(Exception e){
e.printStack();
}
}