Skip to content

Instantly share code, notes, and snippets.

@edenizk
Created May 27, 2018 15:03
Show Gist options
  • Save edenizk/3c7880264adfbcb02751cfa19d6e5c62 to your computer and use it in GitHub Desktop.
Save edenizk/3c7880264adfbcb02751cfa19d6e5c62 to your computer and use it in GitHub Desktop.
some simple tests
package com.example.deniz.modifyarrayandelement;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
import org.w3c.dom.Text;
public class MainActivity extends AppCompatActivity {
TextView txtModifiedArrayElement;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView txtOrginalValuesOFArray = (TextView) findViewById(R.id.txtOrginalValuesOfArray);
TextView txtValuesOfModifiedArray = (TextView) findViewById(R.id.txtValiesOfModifiedArray);
txtModifiedArrayElement = (TextView) findViewById(R.id.txtModifiedArrayElement);
TextView txtOrginalArrayElement = (TextView) findViewById(R.id.txtOrginalArrayElment);
TextView txtArrayElementValueAfterModification = (TextView) findViewById(R.id.txtValueofArrayElementAfterModification);
String[] stringArray = {"A\n", "B\n", "C\n", "D\n", "E\n", "F\n", "G\n",
"H\n", "I\n", "J\n", "K\n", "L\n", "M\n", "O\n",
"P\n", "Q\n", "R\n", "S\n", "T\n", "U\n", "V\n",
"W\n", "X\n", "Y\n", "Z\n"};
String totalOrginalValues = "";
for(String value : stringArray){
totalOrginalValues += value;
}
txtOrginalValuesOFArray.setText(totalOrginalValues);
modify(stringArray);
totalOrginalValues = "";
for(String value : stringArray){
totalOrginalValues += value;
}
txtValuesOfModifiedArray.setText(totalOrginalValues);
txtOrginalArrayElement.setText(stringArray[5]);
modifyElement(stringArray[5]);
txtArrayElementValueAfterModification.setText(stringArray[5]);
}
public void modify(String[] array){
for(int i=0; i<array.length;i++){
array[i]="$"+array[i];
}
}
public void modifyElement (String element){
element = "@#" + element;
txtModifiedArrayElement.setText(element);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment