I want to copy array to array. Is it possible like this?
I want to take some values from an array "arrayList data"
In that array contained an values

I declare inkLevels as my array to put value for the third row. I only need the value from the last row. Inside GetInkLevel. I have place some method, but I sure it is not the good way. Do you have any recomendations?
public class ActivityToSmartWatch extends BaseAdapter {
private Activity activity;
private ArrayList<String[]> data;
private static LayoutInflater inflater = null;
private String[] inkLevels = new String[5];
public ActivityToSmartWatch(Activity a, ArrayList<String[]> inkLevels) {
activity = a;
data = inkLevels;
inflater = (LayoutInflater) activity
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
public int getCount() {
return data.size();
}
public Object getItem(int position) {
return position;
}
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View vi = convertView;
if (convertView == null)
vi = inflater
.inflate(R.layout.listviewitem_ink, null);
if (data.get(position)[0].equals("C"))
{
TextView inkLevel = (TextView)vi.findViewById(R.id.lvi_colorLevel);
inkLevel.setText(data.get(position)[2]);
}
else if (data.get(position)[0].equals("Y"))
{
TextView inkLevel = (TextView)vi.findViewById(R.id.lvi_colorLevel);
inkLevel.setText(data.get(position)[2]);
}
else if (data.get(position)[0].equals("M"))
{
TextView inkLevel = (TextView)vi.findViewById(R.id.lvi_colorLevel);
inkLevel.setText(data.get(position)[2]);
}
else if (data.get(position)[0].equals("B"))
{
TextView inkLevel = (TextView)vi.findViewById(R.id.lvi_colorLevel);
inkLevel.setText(data.get(position)[2]);
}
return vi;
}
public String[] getInkLevel (String [] inkLevels, int position)
{
for (int i= 0; i <data.size(); i++)
{
inkLevels[i] = data.get(i);
}
return inkLevels;
}
}
inkLevelsmeans in more detail? Have you looked at Arrays#copyOf?Map<InkColor,InkInfo>whereInkColoris aenumofc,y,m,kandInkInfois a custom class that wraps the relevant level info - arrays of arrays are often a sign of poor OO design.