Skip to main content

All Questions

1 vote
2 answers
435 views

Show red line in switch case statement with menu in android studio

I have faced the error code red line under case R.id.item ( Constant expression required ) to find the id from menu.xml and I have tried to find the problem but I was unable to find it. MainActivity....
M.alsaoud's user avatar
0 votes
0 answers
33 views

android how to create a switch with showing text on and off how?

i want to create a switch or toggle in my android application that show both text on and off, in my case i use this <Switch android:id="@+id/it_radio_group" style=...
Malo's user avatar
  • 1,448
0 votes
0 answers
26 views

Using onclick with switch case procedure and Gradle 8.0, why can I not use the id from the button

I do not use audios in apps often, a few years ago I did and used the following to play audios as required by the user. The R.id.**** is the id of the button. ''' public void onClick(View v) { ...
ChinaTonka's user avatar
0 votes
0 answers
33 views

problem with switch case in android(java) [duplicate]

(https://i.sstatic.net/HydEx.png) hey guys, i have problem with switch case in android studio in this case i have a radio group "radioGroup_newAc_n1" and 3 radio button "...
Kian's user avatar
  • 1
0 votes
1 answer
42 views

Showing a single TextView after clicks of 6 buttons in android

Hello everyone I am working on a random number generator app where I have implemented six buttons with a switch case that generates random numbers in android. Now trying to implement a logic where I ...
Sufyan Hashmi's user avatar
0 votes
0 answers
24 views

How to combine values in textview

Would it be possible to write this type of action somehow shorter? I have tried the switch but "contains" is disturbing if (TvC.getText().toString().contains("10&...
Jezdi's user avatar
  • 21
1 vote
1 answer
64 views

How do you remove a switch's color or change its on/off color to the same color?

I want to have a switch that switches from 2 different modes, but I can't figure out how to remove the switch color and make on/off the same color. It would be weird if a mode has a different color ...
bramar2's user avatar
  • 45
0 votes
2 answers
53 views

Quantity Button with RadioGroup To Calculate Subtotal Price

Hello I have been struggling to figure out how to get the subtotal with my quantity increment and decrement buttons for subtotal. What I want is after the customers chooses a type the price will show ...
Ivor's user avatar
  • 25
0 votes
1 answer
70 views

How can I use an enum with a switch case in Java? [duplicate]

Previously, I was saving the keys inside SharedPreferencesManager class using this way public static final int KEY_COUNTRY_ID = 5, KEY_COUNTRY_NAME = 10, KEY_CURRENCY_ID = 15, ...
Taha Sami's user avatar
  • 1,639
-1 votes
1 answer
29 views

How can I change a label according to origin of an Activity's opening (Java)?

An Activity X can be opened from the Button A in Activity A and from button B in Activity B, and it should change the label title in XML in Activity X accordingly. I don't know how to create the ...
rafaelahm's user avatar
0 votes
1 answer
232 views

Android Studio Switch label is unreachable for no apparent reason

I'm currently trying to use a switch case statement to convert some color values in Android studios but I keep on getting marked as 'Switch Label is Unreachable'. I've tried recreating a new switch ...
katu's user avatar
  • 3
2 votes
1 answer
522 views

How to check the current state of a SwitchPreference?

I have a SwitchPreferenceCompat and I want to say if Switch preference is enabled show Toast(switch preference is enabled) else it disables again shows a Toast(switch preference is disabled) There ...
AmirHossein's user avatar
0 votes
1 answer
2k views

Duplicate branch in 'switch'. How to avoid the warning

I have a code for my MotionEvent in Android app. It has condition when I release the last finger (ACTION_UP), and the condition when I release the finger, but any other finger still on the screen (...
sunx35's user avatar
  • 53
1 vote
1 answer
174 views

Switch button animation doesn't work in Drawer Navigation View

After spending a lot of time and not finding a suitable solution, I decided to turn to this service for help. I have an example of the simplest application that implements Drawer. This example ...
Tomas's user avatar
  • 1,647
3 votes
1 answer
3k views

How to break kotlin when clause?

Suppose that I have code in Java @Override public boolean onTouch(View view, MotionEvent motionEvent) { switch (motionEvent.getActionMasked()) { case MotionEvent.ACTION_DOWN: { ...
Mateusz Kaźmierczak's user avatar

15 30 50 per page
1
2 3 4 5
43