android-activity

How do I stop playing sound by switching between toggle button?

血红的双手。 提交于 2020-01-17 12:18:15
问题 I have made an alarm clock and there I have used a toggle switch to start my alarm. What I want is as soon as the user click on the button again, it should stop the alarm (ring). Toggling between ON and OFF wil start and stop respectively. But right now, I am only able to start my alarm. In fact it never gets stopped. If I switch the button OFF the sound gets played even faster, that is very strange. How can I stop it? I have pasted the only part of code where I am assuming the problem occurs

Static Value Android Studio

谁说我不能喝 提交于 2020-01-17 11:03:47
问题 I have two Activities. And a static integer called as counter. So if I press a button in activity ' A ' then counter = counter + 1 . Here is the code from activity a: public static int counter = 0; cmdOk.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { counter = counter + 1; if (counter == 5) { tagihan.txtShip1.setTextColor(Color.parseColor("#000000")); tagihan.txtNilai1.setTextColor(Color.parseColor("#000000")); tagihan.txtSupir1.setTextColor(Color

Static Value Android Studio

半腔热情 提交于 2020-01-17 10:59:08
问题 I have two Activities. And a static integer called as counter. So if I press a button in activity ' A ' then counter = counter + 1 . Here is the code from activity a: public static int counter = 0; cmdOk.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { counter = counter + 1; if (counter == 5) { tagihan.txtShip1.setTextColor(Color.parseColor("#000000")); tagihan.txtNilai1.setTextColor(Color.parseColor("#000000")); tagihan.txtSupir1.setTextColor(Color

Android listview item edit operation

我的未来我决定 提交于 2020-01-17 09:12:55
问题 I am new at developing Android App.I have a MainActivity that has a ListView.The data on Listview is hold in a Arraylist.(I dont have any DB).Listview items has 4 field such as coursecode,coursetitle,courselevel,coursedescription.When I clicked an item on Listview,a new activity(ShowDetailActivity) will be launced in order to view detail of course.The editable of the EditViews on ShowDetailActivity are false.On ShowDetailActivity I have an option menu item (Edit).When I clicked the Edit

Android listview item edit operation

℡╲_俬逩灬. 提交于 2020-01-17 09:12:18
问题 I am new at developing Android App.I have a MainActivity that has a ListView.The data on Listview is hold in a Arraylist.(I dont have any DB).Listview items has 4 field such as coursecode,coursetitle,courselevel,coursedescription.When I clicked an item on Listview,a new activity(ShowDetailActivity) will be launced in order to view detail of course.The editable of the EditViews on ShowDetailActivity are false.On ShowDetailActivity I have an option menu item (Edit).When I clicked the Edit

Passing parameters between activities/fragments

◇◆丶佛笑我妖孽 提交于 2020-01-17 07:27:20
问题 Hello Android developers, I'm trying to pass arguments between two distinct activities but I've got stuck into an issue and I can't get out of it. Basically, I'm trying to pass two strings from a fragment contained in my MainActivity, MainFragment to my secondary activity, SecondaryActivity I can pass those two strings from Other Activities to the SecondaryActivity without issues. I can even do that from my NotificationService , but I can't from that specific Fragment. Debugging, I can see

Passing parameters between activities/fragments

北城余情 提交于 2020-01-17 07:27:08
问题 Hello Android developers, I'm trying to pass arguments between two distinct activities but I've got stuck into an issue and I can't get out of it. Basically, I'm trying to pass two strings from a fragment contained in my MainActivity, MainFragment to my secondary activity, SecondaryActivity I can pass those two strings from Other Activities to the SecondaryActivity without issues. I can even do that from my NotificationService , but I can't from that specific Fragment. Debugging, I can see

How can i correctly interact between Activities and fragments

寵の児 提交于 2020-01-17 06:57:07
问题 I'm working with Steppers. So currently i have one Activity with 3 Fragments in which the user must complete with some information, like a Form. There are a lot of information so i made 4 classes to separate that information. In addition, some information is got it automatically so in fragments i ask for permissions... For Example: public class UserIds { @Nullable @Expose String phone; @Expose String Email; @Expose String phone2; @Expose String ModCel; @Expose String Doc; //Setters, getters

notification intent opens the apps main activity in background if its paused

半城伤御伤魂 提交于 2020-01-17 06:28:08
问题 I have a notification service running that will create a notification for the user and if the user clicks the notification it opens an activity to display the message, the method I am using to create the notification is : public void createNotificationMsg(String name,String doing, boolean persistent){ PendingIntent pendingIntent = PendingIntent.getActivity(getApplicationContext(), 0, new Intent(getApplicationContext(), MessageNotificationActivity.class) .setFlags(Intent.FLAG_ACTIVITY_CLEAR

Android - Pass Data Between Two Activities get NullPointerException

北城余情 提交于 2020-01-17 04:55:07
问题 I have 3 activities we will call them A, B and C. A and B both have intents that send the view to C. And design on which one C came from different things happen on C's activity. I pass the data like this from A to C: Intent intent = new Intent(this, C.class); intent.putExtra("Action", "A"); startActivity(intent); Then in C's onCreate method I have something like this: Bundle extras = getIntent().getExtras(); if (extras.getString("Action").equals("A")) { //DO SOMETHING } Then I from B to C I