ピンパッドと同じメソッドを継承するダースのアクティビティがあります。各アクティビティは、ピンパッドを除いて全く異なります。共通のクラスからメソッドを継承するために、私のアクティビティを取得するにはどうすればよいですか?私は何か間違っているのですか?メソッドを継承するアクティビティを取得する方法
public class TestActivity extends PinPadActivity {
TextView mEntry;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test);
mEntry = (TextView) findViewById(R.id.entry_textview);
}
}
public class PinPadActivity extends AppCompatActivity {
String mPin;
String mPinShow;
TextView mEntry;
public void on1Click(View v) {
mPin = mPin+"1";
mPinShow = mPinShow+"*";
mEntry.setText(mPinShow);
}
public void on2Click(View v) {
mPin = mPin+"2";
mPinShow = mPinShow+"*";
mEntry.setText(mPinShow);
}
public void on3Click(View v) {
mPin = mPin+"3";
mPinShow = mPinShow+"*";
mEntry.setText(mPinShow);
}
public void on4Click(View v) {
mPin = mPin+"4";
mPinShow = mPinShow+"*";
mEntry.setText(mPinShow);
}
public void on5Click(View v) {
mPin = mPin+"5";
mPinShow = mPinShow+"*";
mEntry.setText(mPinShow);
}
public void on6Click(View v) {
mPin = mPin+"6";
mPinShow = mPinShow+"*";
mEntry.setText(mPinShow);
}
public void on7Click(View v) {
mPin = mPin+"7";
mPinShow = mPinShow+"*";
mEntry.setText(mPinShow);
}
public void on8Click(View v) {
mPin = mPin+"8";
mPinShow = mPinShow+"*";
mEntry.setText(mPinShow);
}
public void on9Click(View v) {
mPin = mPin+"9";
mPinShow = mPinShow+"*";
mEntry.setText(mPinShow);
}
public void on0Click(View v) {
mPin = mPin+"0";
mPinShow = mPinShow+"*";
mEntry.setText(mPinShow);
}
public void onClearClick(View v) {
mPin = "";
mPinShow = "";
mEntry.setText("");
}
}
ありがとうございます!これは私にとって完璧に機能しました。 – Jay