I have explored numerous options for my specific requirement, but none seem to be suitable or straightforward enough for me to implement without difficulty.
In my list view, there are only a few instances where I need to use superscript 6. However, I am struggling to find a way to incorporate this within a data list array.
Here is the primary Java code behind the activity:
Cadence_list cadence_list_data[] = new Cadence_list[] {
new Cadence_list("Perfect Authentic", "V→I", "V→i", "strongest", "must been in root position with tonic doubled in soprano", "definitive end of a section/piece"),
new Cadence_list("Imperfect Authentic", "V→I", "V→i", "extremely strong", "V to tonic with one or more inverted or not containing tonic in soprano; V7, vii° and vii°⁶ subsitute for V", "firm end of a section/piece"),
new Cadence_list("Half", "any→V", "any→V", "weak", "---", "creates a desire to continue on"),
new Cadence_list("Phrygian Half", "---", "vi⁶→V", "weak", "V7 can substitute for V", "creates desire to continue, particularly to a faster section"),
new Cadence_list("Lydian Half", "---", "iv⁶→V", "weak", "entire iv⁶ chord is raised ½ step", "exactly like Phryigian half, only with a more discordant beginning"),
new Cadence_list("Plagal", "IV→I or ii⁶→I", "iv→i", "weak", "usually preceeded or followed by stronger cadence", "reverential sound requiring absolution with or following a stronger cadence"),
new Cadence_list("Deceptive", "V→not I", "V→not i", "moderate", "cannot go to I in major or i in minor","generates feeling for resolution then denies resolution, causing unease")
};
Cad_listAdapter adapter = new Cad_listAdapter(this,
R.layout.cad_list_layout, cadence_list_data);
cad_list = (ListView)findViewById(R.id.cad_list);
View header = (View)getLayoutInflater().inflate(R.layout.cad_list_head, null);
cad_list.addHeaderView(header);
cad_list.setAdapter(adapter);
Here is the custom constructor (Cadence_list):
public class Cadence_list {
public String cad_name;
public String maj_prog;
public String min_prog;
public String strength;
public String restrict;
public String feel;
public Cadence_list() {
super();
}
public Cadence_list(String cad_name, String maj_prog, String min_prog, String strength, String restrict, String feel) {
super();
this.cad_name = cad_name;
this.maj_prog = maj_prog;
this.min_prog = min_prog;
this.strength = strength;
this.restrict = restrict;
this.feel = feel;
}
}
And here is the custom Adapter (Cad_listAdapter):
public class Cad_listAdapter extends ArrayAdapter<Cadence_list> {
Context context;
int layoutResourceId;
Cadence_list data[] = null;
public Cad_listAdapter(Context context, int layoutResourceId, Cadence_list[] data) {
super(context, layoutResourceId, data);
this.layoutResourceId = layoutResourceId;
this.context = context;
this.data = data;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View row = convertView;
Cad_listHolder holder = null;
if (row == null) {
LayoutInflater inflater = ((Activity)context).getLayoutInflater();
row = inflater.inflate(layoutResourceId, parent, false);
holder = new Cad_listHolder();
holder.txtTitle1 = (TextView)row.findViewById(R.id.cad_name);
holder.txtTitle2 = (TextView)row.findViewById(R.id.maj_prog);
holder.txtTitle3 = (TextView)row.findViewById(R.id.min_prog);
holder.txtTitle4 = (TextView)row.findViewById(R.id.restrict);
holder.txtTitle5 = (TextView)row.findViewById(R.id.strength);
holder.txtTitle6 = (TextView)row.findViewById(R.id.feel);
row.setTag(holder);
}
else {
holder = (Cad_listHolder)row.getTag();
}
Cadence_list cadence_list = data[position];
holder.txtTitle1.setVisibility(View.VISIBLE);
holder.txtTitle2.setVisibility(View.VISIBLE);
holder.txtTitle3.setVisibility(View.VISIBLE);
holder.txtTitle4.setVisibility(View.VISIBLE);
holder.txtTitle5.setVisibility(View.VISIBLE);
holder.txtTitle6.setVisibility(View.VISIBLE);
holder.txtTitle1.setText(cadence_list.cad_name);
holder.txtTitle2.setText(cadence_list.maj_prog);
holder.txtTitle3.setText(cadence_list.min_prog);
holder.txtTitle4.setText(cadence_list.restrict);
holder.txtTitle5.setText(cadence_list.strength);
holder.txtTitle6.setText(cadence_list.feel);
return row;
}
class Cad_listHolder {
TextView txtTitle1;
TextView txtTitle2;
TextView txtTitle3;
TextView txtTitle4;
TextView txtTitle5;
TextView txtTitle6;
}
}
Does anyone know how I can effectively integrate these components within the data array?