I have a list of Clickable TextViews that are relatively doing the same thing. You click on it and it goes to that activity. Settings goes to the settings activity. About to the about and so forth. Is there an easier way to declare and set up these clickable TextViews besides this repetitious code?
TextView create,
edit,
settings,
about;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_navigation);
create = (TextView) findViewById(R.id.create);
create.setTextColor(Color.parseColor("#000000"));
edit = (TextView) findViewById(R.id.edit);
edit.setTextColor(Color.parseColor("#000000"));
settings = (TextView) findViewById(R.id.settings);
settings.setTextColor(Color.parseColor("#000000"));
about = (TextView) findViewById(R.id.about);
about.setTextColor(Color.parseColor("#000000"));
create.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
}
});
edit.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
}
});
settings.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
}
});
about.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
}
});
If you have a small set of items you can take following approach: