android-dialog

How to send data to an AlertDialog [duplicate]

时光怂恿深爱的人放手 提交于 2019-12-23 01:42:15
问题 This question already has answers here : How to pass data from a fragment to a dialogFragment (3 answers) Closed 4 years ago . I'm want to send some data to an altert dialog, to know identify winner player in my game. Here is the code in my MainActivity.java: if (game.comprobarCuatro(Game.JUGADOR)) { dibujarTablero(); resultadoTextView.setText(R.string.gana_humano); new AlertDialogFragment().show(getFragmentManager(),"ALERT DIALOG"); return; } And here is my code in AlertDialogFragment.java,

changing theme of android dialog

谁说我不能喝 提交于 2019-12-22 08:52:08
问题 In my Android application I have set the theme of the app as android:Theme.Holo.Light I created the dialog as final Dialog dialog = new Dialog(DropPicupProcess.this); But when I pop up an dialogbox in the app it shows as below. How can I change the theme of the dialog into android:Theme.Holo.Light . 回答1: Instead of this final Dialog dialog = new Dialog(DropPicupProcess.this); Create your dialog like this.. Dialog dialog=new Dialog(DropPicupProcess.this,android.R.style.Theme_Holo_Light); 回答2:

NullPointerException when creating a new Dialog

时光怂恿深爱的人放手 提交于 2019-12-22 04:11:59
问题 I have a DialogFragment that creates a listview dialog and on a list item click I want to display an alert dialog but when I create the dialog it gives me a NullPointerException with an error that I have never seen before 08-05 11:40:42.315: E/AndroidRuntime(4693): java.lang.NullPointerException 08-05 11:40:42.315: E/AndroidRuntime(4693): at android.app.AlertDialog.resolveDialogTheme(AlertDialog.java:142) 08-05 11:40:42.315: E/AndroidRuntime(4693): at android.app.AlertDialog$Builder.<init>

Android Dim Background of Custom Dialog

試著忘記壹切 提交于 2019-12-21 13:03:16
问题 As titled, I cannot seem to be able to dim the background of the custom dialog box I have made. Countless solutions online mention the last 3 lines of code in the first snippet below, this has made no impact on the UI of the dialog box. See the following code: Dialog dialog = new Dialog(MainActivity.this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog); TextView textView = (TextView) dialog.findViewById(R.id.textView); textView.setText("Custom

Android: Display custom dialog in center of the container

被刻印的时光 ゝ 提交于 2019-12-21 06:59:49
问题 How to display custom dialog as a center of the container? Dialog customdialog = new Dialog(this,android.R.style.Theme_Translucent_NoTitleBar); Window window = customdialog.getWindow(); window.setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); window.setGravity(Gravity.CENTER); R.style.Theme_Translucent_NoTitleBar - is used to remove border for cutomdialog. Once i used this line the dialog will appear at the topleft corner of the tablet? Can anyone help me to solve this issue? 回答1

Facebook app type no internet connection message

夙愿已清 提交于 2019-12-21 02:52:05
问题 How can I show no internet connection message like in facebook app that appears below the tab view. 回答1: You can design this in your XML file and then set its visibility to invisible like this: <RelativeLayout android:id="@+id/relativelayout_connection" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:alpha="0.8" android:background="@android:color/black" > <TextView android:id="@+id

Display DialogFragment content below status bar

▼魔方 西西 提交于 2019-12-20 14:48:53
问题 Im trying to display an DialogFragment with match_parent both for height and width but it happens that on top the DialogFragment is being displayed below StatusBar. The DialogFragment is applying some default value for padding on bottom, right, left, and top. But the top padding should start counting from statusBar and not from the total screen size. How can I set DialogFragment to be match_parent, but have the normal/default padding on top,bottom,right,left? 回答1: By default Dialog would be

convert ArrayList<Class> to string[]

大城市里の小女人 提交于 2019-12-20 06:38:28
问题 I have class Person class person{ int ID ; sting FirstName ; string Last Name ; String Telephone ; } and I have ArrayList<person> ; now I want to display simple list view containing just FirstName + "," + "LastName" so I can use code like AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Select Color Mode"); ListView modeList = new ListView(this); String[] stringArray = new String[] { "Bright Mode", "Normal Mode" }; ArrayAdapter<String> modeAdapter = new

android OnkeyListener with filter stop onItemClicklistener from DPAD

谁说胖子不能爱 提交于 2019-12-20 03:02:37
问题 This is my custom-dialog layout. I want to move the selector of days and load respective items in the grid below it. I could perform it via filter as said here But because of the filter I am not being able to perform the action that should be triggered while clicking items in the grid view. It works fine when I click via mouse but not D-Pad. If I remove the filter in keyevent, it works normally, but problem again in sliding the selector via. As I am working in STB, I have no option except

How to load web view in dialoge in android

空扰寡人 提交于 2019-12-18 18:23:07
问题 I am trying to load web view in to dialog. I am usuing the following code. final TextView seeMonthlyBill = (TextView) parentLayout .findViewById(R.id.my_ac_my_service_timewarnercable_link); seeMonthlyBill.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Dialog dialog = new Dialog(getActivity()); WebView wb = new WebView(getActivity()); wb.getSettings().setJavaScriptEnabled(true); wb.loadUrl("http://www.google.com"); wb.setWebViewClient(new HelloWebViewClient(