android-button

media player play pause in android

淺唱寂寞╮ 提交于 2019-12-01 21:19:28
How can I make the Play and Pause image buttons look as a single image button. I am hereby attaching my code below. These are the images used. i Renamed play as start. import android.app.Activity; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.ProgressBar; public class AudioView extends Activity{ MediaPlayer mp; Button p,pu,s,b,f,h,v,c,bu; ProgressBar myProgressBar; Uri uri=Uri.parse("http://player.trackitdown.net/preview/289245/preview_c-90-feat-red

Call of findViewById in Fragment to find a button returns null

那年仲夏 提交于 2019-12-01 18:11:09
I´m new to android development and I´m trying to write a small, simple Application. This application should do nothing more than reading the text from 2 EditTexts and when the user presses the "send" button it should write the text to 2 TextViews. Each of these TextViews is in one Fragment. But I can´t add the onClickEvent to the Button, because findViewById(R.id.sendTextButton) always returns null. I have tried to get this App working but I wasn´t able to find any solution by now. Here are the relevant codeBlocks: The onCreateView function of the fragment, that should handle the first input

How to prevent double code running by clicking twice fast to a button in Android

谁说我不能喝 提交于 2019-12-01 16:06:17
If i click fast to my button in my Android app, it seems that code behind it runs twice. If i click my menu button twice the activity that has to be launch onclick just starts twice and i have to quit from it twice. This is really annoying because if i click too fast for menu buttons i can load up a whole bunch of activities in the background and i must quit them one by one, so this is clearly a buggy state of my app i want to fix this. What can i do with this issue? I use simple onClickListeners and Buttons EDIT: Regarding to answers and comments my menu buttons look like this: top20Button

How to prevent double code running by clicking twice fast to a button in Android

浪尽此生 提交于 2019-12-01 14:09:23
问题 If i click fast to my button in my Android app, it seems that code behind it runs twice. If i click my menu button twice the activity that has to be launch onclick just starts twice and i have to quit from it twice. This is really annoying because if i click too fast for menu buttons i can load up a whole bunch of activities in the background and i must quit them one by one, so this is clearly a buggy state of my app i want to fix this. What can i do with this issue? I use simple

Android - change dialog button location

拥有回忆 提交于 2019-12-01 08:30:39
Is it possible to change the location of the button on the dialog to the outside of the dialog itself? something like this (the red squares are buttons): I know I can get the button with : dialog.getButton(AlertDialog.BUTTON_NEGATIVE) but I couldn't find on the manual the way to change it's location. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:padding="20dp" android:background="#00000000">

Android EditText - Delete the last letter with a button

≡放荡痞女 提交于 2019-12-01 06:39:15
I have to buttons that writes A and B to an edittext. If there is something in the edittext how can I delete the last letters with the "Del" button? My layout: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" > <Button android:id="@+id/buttonb" android:layout_width="100dp" android:layout_height="100dp" android:layout_alignParentLeft="true" android:layout_below="@+id/buttona" android:text="@string/buttonb" android

java.lang.IllegalStateException: cannot find button's onClick method in Android Studio

只愿长相守 提交于 2019-12-01 04:46:59
I am building an app named Ping in Android Studio. So far my activities are LoginActivity ProfileActivity and Timeline. My issue is that a button in the layout corresponding to the Timeline activity has an onClick method that isn't working. When the button is clicked, the emulator gives the "Unfortunatley, Ping has stopped." I'm defining the buttons and onClick methods the same way I have for other buttons whose functions are working, just this one does not seem to work. I'm receiving an error saying the method can't be found, but I've written the method in the corresponding activity. Here is

Android - change dialog button location

喜夏-厌秋 提交于 2019-12-01 04:11:02
问题 Is it possible to change the location of the button on the dialog to the outside of the dialog itself? something like this (the red squares are buttons): I know I can get the button with : dialog.getButton(AlertDialog.BUTTON_NEGATIVE) but I couldn't find on the manual the way to change it's location. 回答1: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android

Changing button style in the whole application

家住魔仙堡 提交于 2019-12-01 03:43:46
I'm trying to change all the TextColor of my buttons in my app to white and also trying to make it bold. But that isn't happening, I'm overwriting the android:Widget.Button I'm developing for Jelly Bean 4.1.2 What am I doing wrong? Theme definition in manifest android:theme="@style/spui" > The theme where I like to <style name="spui" parent="android:Theme.Holo.Light.DarkActionBar"> <item name="android:buttonStyle">@style/Buttonspui</item> </style> The style for the button itself <style name="Buttonspui" parent="android:Widget.Button"> <item name="android:background">@drawable/btn_default_holo

Remove text padding in Button view

落爺英雄遲暮 提交于 2019-12-01 02:53:51
I would like to remove the padding around text in Button view. The first screenshot is the result I would achieve, and the second one is the state of the art. Of course, I have defined a custom drawable to get the button appearance. But even if I set the padding attribute to 0dp the result does not change. Any suggestion, please? EDIT Here is the xml code of the button <Button android:id="@+id/btnCancel" style="@style/dark_header_button" android:layout_width="wrap_content" android:layout_marginLeft="10dp" android:layout_height="wrap_content" android:includeFontPadding="false" android:padding=