android


why text is texted wrongly in this method in android?


please help me! at first please follow this algorithm:
1- btn_set1 is clicked, its functions are doing.
2- btn_set2 is clicked, "text1" is SetText ed into "+"!!!
WHY???
please help me, how can i solve this problem? thanks.
public void onClick(View view) {
switch (view.getId()){
//time picker pannel
case R.id.btn_set1:
text1.setText(aTime);
intent1 = new Intent(this, alarmService.class);
intent1.putExtra("rq1", req_code);
intent1.putExtra("alarm_time", alarm_time1);
startService(intent1);
alinear.setAnimation(animLeft);
Linear.setVisibility(View.GONE);
text2.setVisibility(View.VISIBLE);
break;
case R.id.btn_set2:
text2.setText(aTime);
intent2 = new Intent(this, alarmService.class);
intent2.putExtra("rq2", req_code);
intent2.putExtra("alarm_time", alarm_time1);
startService(intent2);
LLinear.setAnimation(animLeft);
Linear.setVisibility(View.GONE);
case R.id.btn_cancle1:
Linear.setAnimation(animLeft);
Linear.setVisibility(View.GONE);
cancel_one(text1);
break;
case R.id.btn_cancle2:
Linear.setAnimation(animLeft);
Linear.setVisibility(View.GONE);
cancel_one(text2);
break;
}
}
private void cancel_one(TextView textView) {
if(intent1 != null)
stopService(intent1);
if(intent2 != null)
stopService(intent2);
textView.setText("+");
}
You forgot to put a break statement in the case 2: and hence case 3: also gets invoked called when case 2 is invoked

Related Links

No emulator image found while creating a cordova mobile app
How to get the UUID from MAC address for Bluetooth Connectivity?
Animate circle in Android with data
Indexing of moveToPosition of Cursor in Android
How to make a widget work on the click of a button?
Implementing android:choiceMode in a RecyclerView
Download the latest android SDK documentation (when SDK manager version is lagging behind)
ViewPager with FragmentPagerAdapter
WebView Video FullScreen Mode Crash in some of Android Device When using application context
Dagger 2 lifecycle of a component, module and scope
Send sensing data on Android to Amazon Web Services
java.lang.OutOfMemoryError: pthread_create (1040KB stack) failed: Try again
Draw on SurfaceView with Bitmap as background
Android Handling orientation changes - no change if rotation occurs
Google Sign in Error -Firebase android codelab
How to do Firebase query(.equalTo(key))on childListener and map to String

Categories

HOME
httparty
ggplot2
pda
replace
opendj
javacc
telegram-bot
missing-data
joomla3.0
computer-science
32bit-64bit
dkim
startup
opengl-es-3.0
datastage
filechannel
selenium-ide
3nf
poedit
articulate-storyline
cgbitmapcontext
ios10.2
ckfinder
onload
google-cloud-print
beautifier
appirater
jasmine-node
amazon-quicksight
has-and-belongs-to-many
magento-1.8
mobx
scatter3d
hibernate-validator
android-sugarorm
sendbird
engine.io
magento-1.9.2.4
jpad
ideascript
modernizr
amazon-ses
filesystemwatcher
gdata
hackintosh
preloader
photos
apache-directory
proget
dbcontext
launchctl
trigger.io
pybrain
offline.js
swingworker
pocketsphinx-android
rmongo
mapinfo
shopping
uiactionsheet
html-to-pdf
beanstalk
cycle2
mobiledoc-kit
wiredep
page.js
coda
.bash-profile
visual-sourcesafe-2005
iced-coffeescript
airbrake
botan
osc
android-broadcast
diff3
xmltype
procedural-programming
adehabitathr
mass-assignment
jbake
insight.database
ignite-ui
template-deduction
codeplex
wxformbuilder
alternate
buffering
renderer
menubar
qscrollarea
visual-studio-express
pagedown
windows-98
intersect
qi4j
fragmenttransaction
predicatebuilder
wiimote
stress
gobject-introspection
automationelement
cgbitmapcontextcreate
quotation-marks
metaweblog
facebook-iframe
non-clustered-index
easyb
rowlex
hbm2java
folding
filesystemobject
complex-event-processing
xpsdocument
scrubyt
mathematical-typesetting
idatareader

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App