あるクラスから別のクラスへの値配列を使用したい。ActivityReceiver では、配列を取り、それを StringinkLevel [][] に渡します。
その後、特定の値を取得したいので、getInkLevel を取得して、必要な特定の値 (color[]) を保存する配列に返します。
public class ActivityReceiver extends Activity {
public ArrayList<String[]> arrays ;
public String[]color = new String [4];
public String[][] inkLev ;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle bundle = getIntent().getExtras();
if (bundle != null)
{
int count = bundle.getInt("com.PrinterStatus.AppLab.ARRAYS_COUNT", 0);
ArrayList<String[]> arrays = new ArrayList<String[]>(count);
for (int i = 0; i < count; i++)
{
arrays.add(bundle.getStringArray("com.PrinterStatus.AppLab.ARRAY_INDEX" + i));
String[][] inkLev = arrays.toArray(new String[][]{});
}
}
}
public String[] getInkLevel(String[] lev)
{
color[0]= inkLev[0][2];
color[1]= inkLev[1][2];
color[2]= inkLev[2][2];
color[3]= inkLev[3][2];
return color;
}
別のクラスで。numberC 変数を入力しました。そして、特定の値、example color[1] をその変数に入れたいと思います。
...
tonerAmountC = (TextView)mSmartView.findViewById(R.id.ImageC);
tonerAmountC.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v)
{
enterednumberC = ??;
Log.d(SampleExtensionService.LOG_TAG, "Read from file: " + enterednumberC);
tonerAmountC.setText(enterednumberC);
}
});
mSmartView.addViewToWatch(tonerAmountC);
...
何を追加すればいいですか?ありがとう