Calculate with data from 2 textedit and show result in textview - android

I want to calculate a value from the data in 2 text edits and show the result in a textview. How can I do it?
BMI calculator:
private TextView deinbmi;
private EditText weight;
private EditText height;
public void calculator ()
{
double ergebnis;
weight=(EditText)findViewById(R.id.text_calculator_weight);
height=(EditText)findViewById(R.id.text_calculator_height);
double a=Double.parseDouble(weight.getText().toString());
double b=Double.parseDouble(height.getText().toString());
ergebnis=a*b;
deinbmi.setText(""+ergebnis);
}
I don't have an idea; I just started with Java. I can program with C++ but just console.
If I search on the internet for this problem, everyone has another version of solving this, but none of these answers worked for me?

Try This Working code.
you Missing the Textview Inside oncreate, Then Add a Button for Getting the Answer
public class Mainactivity extends Activity implements OnClickListener
{
private TextView deinbmi;
private EditText weight;
private EditText height;
Button Answer;
#Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.page1_landing);
weight=(EditText)findViewById(R.id.text_calculator_weight);
height=(EditText)findViewById(R.id.text_calculator_height);
deinbmi=(Textview)findViewById(R.id.text);
Answer=(Button)findViewById(R.id.answerbuttton);
Answer.SetOnclicklistener(this);
}
#Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.answerbuttton:
calculator ();
break;
}}
public void calculator ()
{
double ergebnis;
double a=Double.parseDouble(weight.getText().toString());
double b=Double.parseDouble(height.getText().toString());
ergebnis=a*b;
deinbmi.setText(""+ergebnis);
}
}

public class calculator extends ActionBarActivity {
private TextView deinbmi;
private EditText weight;
private EditText height;
public void calculator ()
{
double ergebnis;
weight=(EditText)findViewById(R.id.text_calculator_weight);
height=(EditText)findViewById(R.id.text_calculator_height);
double a=Double.parseDouble(weight.getText().toString());
double b=Double.parseDouble(height.getText().toString());
ergebnis=a*b;
deinbmi.setText(""+ergebnis);
}
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_calculator);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_calculator, menu);
//rechnen ?!
Button credits_calculate = (Button)
findViewById(R.id.button_calculate);
credits_calculate.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
calculator();
}
});
//back
Button credits_back = (Button)
findViewById(R.id.button_calculator_back);
credits_back.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
finish();
}
});
return true;
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
is my activity
i tryed to use your code but
Answer=(Button)findViewById(R.id.answerbuttton);
Answer.SetOnclicklistener(this);
he didnt understand this

Related

Android: OnlongClickListener, detect when it stops [duplicate]

This question already has answers here:
Android - Detect End of Long Press
(4 answers)
Closed 4 years ago.
I would like to detect when a button is not clicked. For instance, in the code above, I would like to replace the ????? with a condition indicating that the imageview is still being clicked and quit the loop as soon as the imageview is not long clicked anymore. Do you have an idea?
imageView.setOnLongClickListener(new View.OnLongClickListener() {
#Override
public boolean onLongClick(View v) {
while(?????)
{
int number =(Integer.parseInt(hours.getText().toString())+1)%24;
String text_number= String.valueOf(number);
if(number>-1 && number<10)
{
text_number="0"+text_number;
}
hours.setText(text_number);
}
return true;
}
});
Use View.OnTouchListener.
Example: https://stackoverflow.com/a/39588668/4586742
You will get onTouch callback with different events.
MotionEvent.ACTION_DOWN: when the user starts pressing the view.
MotionEvent.ACTION_UP: when the user stops pressing the view.
What i get from your question and proposed answer for you.
`
public class Main2Activity extends AppCompatActivity {
private boolean isImageViewBeingClicked = true;
private boolean isLongPressed = false;
private ImageView imageView;
private TextView hours;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
imageView = (ImageView) findViewById(R.id.imageView);
hours = (TextView) findViewById(R.id.textView);
imageView.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
while (isImageViewBeingClicked) {
int number = (Integer.parseInt(hours.getText().toString()) + 1) % 24;
String text_number = String.valueOf(number);
if (number > -1 && number < 10) {
text_number = "0" + text_number;
}
hours.setText(text_number);
}
}
});
imageView.setOnTouchListener(new View.OnTouchListener() {
#Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
if (isLongPressed) {
isImageViewBeingClicked = false;
}
}
return false;
}
});
imageView.setOnLongClickListener(new View.OnLongClickListener() {
#Override
public boolean onLongClick(View v) {
isLongPressed = true;
return false;
}
});
}
}
`

Android RadioButton Color-Change for other Activity

I´m new in Android Programming and I have a question for my project.
I want to Change my Background for my Start-Activity (it´s a Reaction Game).
There is an extra activity for all settings (BackgroundColor, Sound etc.),
and I´m lost at this part :/ I want to choose one Color in the Setting-Activity (blue & red), and change the background to the choosen color in the start-Acitivity. Here is the Code for the Activity-Setting, the RadioButtons for the Colors are in one Group (RadioGroup_Color). Does anybody know how to fix this?
I always get an error when I execute this code:
public class activity_settings extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_activity_settings);
colorchange();
}
public void colorchange() {
final RadioGroup radioGroup = (RadioGroup) findViewById(R.id.RadioGroup_Color);
final RelativeLayout background = (RelativeLayout) findViewById(R.id.start);
final Button button_save = (Button) findViewById(R.id.button_save);
button_save.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
changeOption(background);
}
});
final RadioButton changeToBlue = (RadioButton) findViewById(R.id.button_blue);
changeToBlue.setOnCheckedChangeListener(new radioGroup.OnCheckedChangeListener() {
public void onClick(View v) {
changeToBlue(background);
}
});
final RadioButton changeToRed = (RadioButton) findViewById(R.id.button_red);
changeToRed.setOnCheckedChangeListener(new radioGroup.OnCheckedChangeListener() {
public void onClick(View v) {
changeToRed(background);
}
});
}
public void changeOption(RelativeLayout background) {
if (background.isEnabled()) {
background.setEnabled(false);
} else {
background.setEnabled(true);
}
}
public void changeToBlue(RelativeLayout background) {
background.setBackgroundColor(0x0000FF00);
background.invalidate();
}
public void changeToRed(RelativeLayout background) {
background.setBackgroundColor(0x0000FF00);
background.invalidate();
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_activity_settings, menu);
return true;
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}}
The Error-Message:
Error:(38, 91) error: <anonymous com.example.clecks.reaction_game.activity_settings$2> is not abstract and does not override abstract method onCheckedChanged(CompoundButton,boolean) in OnCheckedChangeListener
EDIT
After suggestions and fixes, I still get:
Error:(8, 8) error: com.example.clecks.reaction_game.OnCheckedChangeListener is not abstract and does not override abstract method onCheckedChanged(CompoundButton,boolean) in android.widget.CompoundButton.OnCheckedChangeListener.
When i click on it there opens a new class named OnCheckedChangeListener.java:
public class OnCheckedChangeListener implements CompoundButton.OnCheckedChangeListener { }
Let's take your actual error:
Error:(38, 91) error: is not abstract and does not override abstract method onCheckedChanged(CompoundButton,boolean) in OnCheckedChangeListener
You miss a onCheckedChanged(CompoundButton,boolean) implementation on a OnCheckedChangeListener.
Looking at your code I can see two OnCheckedChangeListener inplementations; here is one:
changeToBlue.setOnCheckedChangeListener(new radioGroup.OnCheckedChangeListener() {
public void onClick(View v) {
changeToBlue(background);
}
});
Those implementations are wrong.
You need to override onCheckedChanged(CompoundButton,boolean) (onClick(View) does not exists in OnCheckedChangeListener) as the error reports. Also new radioGroup.OnCheckedChangeListener is wrong and causes the main error.
Fix your code with:
changeToBlue.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
#Override
public void onCheckedChanged(CompoundButton c, boolean b) {
changeToBlue(background);
}
});
Have a look at the simple official documentation.

how to define button display to appear one by one with animation?

i have 9 buttons in my activity, i use push right animation to show my buttons on Create, i change duration to set display, so i have 9 animation.xml with diffrent duration (from 1000 to 5000 for ex).
also i have to repeat 3 line code for 9 time in activity ,
final Button b = (Button)findViewById(R.id.Button06);
Animation anim=AnimationUtils.loadAnimation(MainActivity.this, R.anim.push_right_in);
b.startAnimation(anim);
so, i need to know is there any easier way to make something like that with Less code?
for ex, use 1 animation.xml and define button to run animation One after another?!
my full code:
import android.support.v7.app.ActionBarActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationUtils;
import android.widget.Button;
public class MainActivity extends ActionBarActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final Button b = (Button)findViewById(R.id.Button06);
Animation anim=AnimationUtils.loadAnimation(MainActivity.this, R.anim.push_right_in);
b.startAnimation(anim);
final Button b1 = (Button)findViewById(R.id.Button03);
Animation anim1=AnimationUtils.loadAnimation(MainActivity.this, R.anim.push_right_in1);
b1.startAnimation(anim1);
final Button b2 = (Button)findViewById(R.id.button1);
Animation anim2=AnimationUtils.loadAnimation(MainActivity.this, R.anim.push_right_in2);
b2.startAnimation(anim2);
final Button b3 = (Button)findViewById(R.id.Button08);
Animation anim3=AnimationUtils.loadAnimation(MainActivity.this, R.anim.push_right_in3);
b3.startAnimation(anim3);
final Button b4 = (Button)findViewById(R.id.Button04);
Animation anim4=AnimationUtils.loadAnimation(MainActivity.this, R.anim.push_right_in4);
b4.startAnimation(anim4);
final Button b5 = (Button)findViewById(R.id.Button01);
Animation anim5=AnimationUtils.loadAnimation(MainActivity.this, R.anim.push_right_in5);
b5.startAnimation(anim5);
final Button b6 = (Button)findViewById(R.id.Button07);
Animation anim6=AnimationUtils.loadAnimation(MainActivity.this, R.anim.push_right_in6);
b6.startAnimation(anim6);
final Button b7 = (Button)findViewById(R.id.Button05);
Animation anim7=AnimationUtils.loadAnimation(MainActivity.this, R.anim.push_right_in7);
b7.startAnimation(anim7);
final Button b8 = (Button)findViewById(R.id.Button02);
Animation anim8=AnimationUtils.loadAnimation(MainActivity.this, R.anim.push_right_in8);
b8.startAnimation(anim8);
b.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
startButtonAnimation(b);
}
});
}
public void startButtonAnimation(Button btn){
Animation shake = AnimationUtils.loadAnimation(this, R.anim.shake);
btn.setAnimation(shake);
btn.startAnimation(shake);
shake.setAnimationListener(new AnimationListener() {
#Override
public void onAnimationStart(Animation animation) {
}
#Override
public void onAnimationRepeat(Animation animation) {
}
#Override
public void onAnimationEnd(Animation animation) {
startActivity(new Intent(getApplicationContext(), Activity2.class));
overridePendingTransition(R.anim.animation, R.anim.animation2);
}
});
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
Yes you can create method
private void buttonAnim(int buttonId, long duration){
Button b = (Button) findViewById(buttonId);
Animation anim=AnimationUtils.loadAnimation(MainActivity.this,your_anim_id);
anim.setDuration(duration);
b.startAnimation(anim);
}
And use it to call your animation for ex:
buttonAnim(R.anim.Button06, 1000);
Additionally you can put your buttons in array and do it in loop as is shown in the code below:
int[] buttonsArrays = new int {
R.anim.Button01,
R.anim.Button02,
R.anim.Button06,
...
}
int[] durations = new int {
1000,
5000,
1000,
...
}
And in your code:
for(int index=0; index <buttonsArrays.length; index++){
buttonAnim(buttonsArrays[index],durations[index]);
}
But remember the lengths of arrays have to be the same
Or you can use Pair object as is shown in the code below:
Pair<Integer, Long>[] pairs = new Pair[]{
new Pair(R.id.Button01, 1000l),
new Pair(R.id.Button02, 5000l),
...
};
And in your code:
for(Pair<Integer,Long> pair : pairs ){
buttonAnim(pair.first,pair.second);
}
It will be most save
EDIT
Please find my proposition of your class:
public class MainActivity extends ActionBarActivity {
private final ButtonSupport[] buttonSupports = new ButtonSupport[]{
new ButtonSupport(R.id.Button06,1000l, YourClassActivity.class),
new ButtonSupport(R.id.Button03, 2000l,YourClassActivity2.class),
new ButtonSupport(R.id.button1, 3000l,YourClassActivity3.class),
new ButtonSupport(R.id.Button08, 4000l,YourClassActivity4.class),
new ButtonSupport(R.id.Button04, 5000l,YourClassActivity5.class),
new ButtonSupport(R.id.Button01, 6000l,YourClassActivity6.class),
new ButtonSupport(R.id.Button07, 7000l,YourClassActivity7.class),
new ButtonSupport(R.id.Button05, 8000l,YourClassActivity8.class),
new ButtonSupport(R.id.Button02, 9000l,YourClassActivity9.class),
};
private static class ButtonSupport{
final int buttonId;
final long duration;
final Class<? extends Activity> clazz;
ButtonSupport(int buttonId, long duration, Class<? extends Activity> clazz) {
this.buttonId = buttonId;
this.duration = duration;
this.clazz = clazz;
}
}
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
for (ButtonSupport buttonSupport : buttonSupports) {
animButton(buttonSupport);
}
}
private void animButton(final ButtonSupport buttonSupport) {
final Button button = (Button) findViewById(buttonSupport.buttonId);
button.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
startButtonAnimation(v, buttonSupport.clazz);
}
});
Animation anim = AnimationUtils.loadAnimation(MainActivity.this, R.anim.your_animation);
anim.setDuration(buttonSupport.duration);
button.startAnimation(anim);
}
public void startButtonAnimation(View btn, final Class<? extends Activity> clazz) {
Animation shake = AnimationUtils.loadAnimation(this, R.anim.shake);
btn.setAnimation(shake);
btn.startAnimation(shake);
shake.setAnimationListener(new Animation.AnimationListener() {
#Override
public void onAnimationStart(Animation animation) {
}
#Override
public void onAnimationRepeat(Animation animation) {
}
#Override
public void onAnimationEnd(Animation animation) {
startActivity(new Intent(getApplicationContext(), clazz));
overridePendingTransition(R.anim.animation, R.anim.animation2);
}
});
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}

Sliding menu in android,misbehaviour

I am using Sliding menu from library jfeinstein, i have two sliding menu 'menuLeft' 'menuRight' in my activity one from left side and one from right,i have toggle buttons for respective sliding menu,how ever if menuLeft is open and if i slide from right to left in order to close menuLeft ,menuRiht also gets opened,what can be the solution to avoid this misbehaviour
here's my activity which contains SlidingMenu's
public class ChatListActivity extends SherlockActivity {
private SlidingMenu menuLeft;
private SlidingMenu menuRight;
private Button btnSliderLeftToggle;
private Button btnSliderRightToggle;
private ListView lvSliderLeft;
private ListView lvSliderRight;
private int width;
private int height;
private DBContacts db;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.chatlist_layout);
db = new DBContacts(this);
WindowManager wmanager = (WindowManager) getSystemService(WINDOW_SERVICE);
Display display = wmanager.getDefaultDisplay();
width = display.getWidth();
height = display.getHeight();
menuLeft = new SlidingMenu(this);
menuRight = new SlidingMenu(this);
initLeftSlider();
initRightSlider();
btnSliderLeftToggle = (Button) findViewById(R.id.mnuSlidingleftToggle);
btnSliderLeftToggle.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v)
{
ChatListActivity.this.menuLeft.toggle();
}
});
btnSliderRightToggle = (Button) findViewById(R.id.mnuSlidingRightToggle);
btnSliderRightToggle.setOnClickListener(new OnClickListener()
{
#Override
public void onClick(View v)
{
ChatListActivity.this.menuRight.toggle();
}
});
menuLeft.setOnOpenedListener(new OnOpenedListener()
{
#Override
public void onOpened()
{
lvSliderLeft = (ListView) findViewById(R.id.lvSlidingmenuLeft);
MySLidingMenuLeftAdapter adapter = new MySLidingMenuLeftAdapter(ChatListActivity.this,
R.layout.crow_listview_lvslidingleft_chatlist);
lvSliderLeft.setAdapter(adapter);
}
});
menuRight.setOnOpenedListener(new OnOpenedListener()
{
#Override
public void onOpened()
{
lvSliderRight = (ListView) findViewById(R.id.lvSlidingmenuRight);
String column[] = new String[] { DBContacts.USERNAME};
int[] viewId = { R.id.txtContactName};
Cursor dataBaseCursor = db.getAllContacts();
MySLidingMenuRightAdapter customContactListAdapter = new MySLidingMenuRightAdapter(
ChatListActivity.this, R.layout.crow_lvslidingmenu_right_chatlist, dataBaseCursor, column,
viewId, 0);
lvSliderRight.setAdapter(customContactListAdapter);
}
});
}
private void initRightSlider()
{
menuRight.setMode(SlidingMenu.RIGHT);
menuRight.setBehindOffsetRes(R.dimen.slidingmenu_offset);
menuRight.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
menuRight.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
menuRight.setMenu(R.layout.sliding_menu_chatlist_right);
menuRight.setFadeDegree(0.35f);
}
private void initLeftSlider()
{
menuLeft.setMode(SlidingMenu.LEFT);
menuLeft.setBehindOffsetRes(R.dimen.slidingmenu_offset);
menuLeft.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
menuLeft.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
menuLeft.setMenu(R.layout.sliding_menu_chatlist_left);
menuLeft.setFadeDegree(0.35f);
}
#Override
public void onBackPressed()
{
super.onBackPressed();
System.exit(0);
}
#Override
public boolean onCreateOptionsMenu(Menu menu)
{
menu.add("Refresh");
return true;
}
#Override
public boolean onOptionsItemSelected(MenuItem item)
{
new SendNativeContacts(this).execute();
return true;
}
}
I have never faced this issue when i used both Left and Right SlidingMenu but for your problem you can have look at SlidingMenu Issues and you can try this solution for your problem. It may help you.
EDIT :
try this
You will need a patch which calls onOpened and onClosed methods for right menu it may have been included in latest code. Write logs to check method calls.
slidingMenuLeft.setOnOpenedListener(new OnOpenedListener() {
#Override
public void onOpened(int pos) {
slidingMenuRight.setSlidingEnabled(false);
}
});
slidingMenuLeft.setOnClosedListener(new OnClosedListener() {
#Override
public void onClosed() {
slidingMenuRight.setSlidingEnabled(true);
}
});
slidingMenuRight.setOnOpenedListener(new OnOpenedListener() {
#Override
public void onOpened(int pos) {
slidingMenuLeft.setSlidingEnabled(false);
}
});
slidingMenuRight.setOnClosedListener(new OnClosedListener() {
#Override
public void onClosed() {
slidingMenuLeft.setSlidingEnabled(true);
}
});

Need help to change the textview content on button click

This is my code. In this code I am trying to change the content of four text on a button click on first time and on same button click I am trying to change the content of only three textview. But it's not working.
public class Home_page_Activity extends Activity {
Button next;
int textids[]={R.id.text1,R.id.text2,R.id.text3,R.id.text4};
String Question[]={"1","2","3","4"};
String three[]={"7","27","37"};
TextView t1,t2,t3,t4,t5,t6,t7;
int count=0;
int check=0;
//int button_id[]={R.id.next};
//Button btn[];
int test=0;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home_page_);
t1=(TextView)findViewById(R.id.text1);
t2=(TextView)findViewById(R.id.text2);
t3=(TextView)findViewById(R.id.text3);
t4=(TextView)findViewById(R.id.text4);
t5=(TextView)findViewById(R.id.text5);
t6=(TextView)findViewById(R.id.text6);
t7=(TextView)findViewById(R.id.text7);
next=(Button)findViewById(R.id.next);
next.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
if(test==1)
{
String get=(String) t1.getText();
//int inter=Integer.parseInt(get);
Log.i("t1", get);
t1.setText("");
t2.setText("");
t3.setText("");
t4.setText("");
threetext();
}
nextquestion();
}
});
}
public void nextquestion()
{
t1.setText(Question[count]);
t2.setText(Question[count+1]);
t3.setText(Question[count+2]);
t4.setText(Question[count+3]);
Log.i("count", "value" +count);
test++;
}
public void threetext()
{
Log.i("threetext", "working");
t1.setText(three[check]);
t2.setText(three[check+1]);
t3.setText(three[check+2]);
t4.setText("");
}
Could you increment a counter in the onClick and change the views based on the counter value?

Categories

Resources