In Android How to Use Tab Layout in Alert Dialog Box? - android

In Android Application I want to Customize Alert Dialog Box shown below.Alert Dialog contain a Tab Layout With 3 Tabs.

Create a XML with the desired views (including the table) and call
View view = // instantiate it. Maybe with LayoutInflater(?)
new AlertDialog.Builder(myContext)
.setView(view);
.create();

Create a transparent Activity with Tab Layout..
Check this link for creating tab layout clickhere
Check this out for transparent activity clickhere

Related

How to display calculator inside dialog box

How to display calculator inside dialog box in android? I saw some examples but they add only view inside dialog box, but I want to add whole activity inside dialog.
You can put the following line inside your AndroidManifest, to make your activity like a dialog.
android:theme="#android:style/Theme.Dialog"

How to set the custom dialog on exact location when i click on view in android?

When I click on image then custom dialog is show on Top of the screen so Please can any one suggest me that how to set custom dialog at the exact location that was clicked
You can check-out this link if you want to stick to custom dialog, but if you are interested then you can use pop up window instead of custom dialog, its very easy to use popup window and you can position it nice and easy.
For this purpose u can use PopupWindow to fit the view at location u want. u can setcontentview here as well similar to custom dialog.

How to display customized alert dialog within multiple tab widgets in android?

I have to create customized alert in my android application. And this is my page
I have created 4 main tabs and two subtabs within my tab widget. pnr status is my first tab first page. Within that i have created customized list view. When i clicked my list view I have to show my customized alert view . I can create my customized alert. My code is here. http://pastie.org/8366400
Now my issue is When i click the list view content it shows some error my errors are http://pastie.org/8366406.
My launcher activty have four tabs. which means main actiivty. Then my first tab content is pnr status and schedule . So my pnr status will be shown first when i opened my application. But I tired some other way and found some thing. When i give my pnrstatus activity as launcher activty means my coustomized alert would shown. In the means time when i give my maintab actiivty as launcher it won't come. Now my question is If we are using tabwidget within tabwidget means our is alert won't come? Can any body help me to resolve this issue?
Use getParent() instead of context
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getParent());
refer Android dialogs are causing android.view.WindowManager$BadTokenException: Unable to add window
Try this, You can create your own xml file. setContentView this method you can set your customview.
final Dialog dialog = new Dialog(YourActivity.this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
//Add your lyout
dialog.setContentView(R.layout.Yourlayout);
dialog.setCancelable(true);
// Declare your view here
// Do your stuff here
dialog.show();

display a view when an activity starts

I need to display a certain view when an activity starts, and when the user click ckecked to dismiss the view. It look like this
:
Has anyone an idea how can I do this? Any idea is welcome.
Yes, you can use a custom dialog
just create a custom XML and inflate it into your dialog object
Dialog dialog = new Dialog(mContext);
dialog.setContentView(R.layout.custom_dialog);
dialog.show();
and then dismiss it by calling dialog.dismiss();
create custom dialog using below link and open it when activity starts...
you need to increase the margin to proivde more spaces
Have a look at custom dialog examples -
custom dialog 1
custom dialog 2
yes, you can use PopupWindow for Creating window
see these tutorila for adding PopupWindow in your Activity:
Using the PopupWindow class in Android apps
Example of using PopupWindow
You could use a RelativeLayout for this. When the user clicks check, the visibility of the 'upper' layout must be set to GONE.

How To Get A Pop Up Layout?

How can I have a pop-up window, with a new layout, but with the old layout in the background?
Also I'd like to have a button on the first layout call the second layout based on an if-statement, using something like this
"if Button has a background, button open new layout, if not null"
You could use a Dialog to create the pop-up. For example, in your activity onCreate() method set up a new dialog and specify the layout using XML like normal.
Dialog dialog = new Dialog(this);
dialog.setContentView(R.layout.--);
then simply call dialog.show() when you want to show the pop-up.

Categories

Resources