0

I was just wondering if its possible to show the response of webservice, a json formated, to a custom dialog, example opening hours of a restaurant?

The problem is I have a listview and onClicklistener, it opens new activity and there I parsing data from webservice. inside the activity is a button where I getting hours from again from webservice. So I was wondering instead of opening new activity for hours, its possible to pars the json data to custom dialog/alert or sth like this? instead of a new activity?

Tirolel
  • 928
  • 3
  • 17
  • 43

1 Answers1

1

If I understand you correctly, no. A Dialog needs an Activity. What you can do is create an Activity and give it a Dialog Theme. All you have to do is add

      @android:theme="@android:style/Theme.Dialog"

to your <activity> tag in your manifest. This will give the look of a Dialog with the functionality of an Activity

codeMagic
  • 44,549
  • 13
  • 77
  • 93
  • thats true. but is there way to resize or make it fit 50% of the screen? – Tirolel Jun 20 '13 at 23:11
  • You can size the `layout` of it however you like. I haven't tried because anytime I use this, which is quite a bit, it works out nicely. I believe you can use `getWindow()` or something similar. I would have to look it up or see if I can find where I do it – codeMagic Jun 21 '13 at 00:26
  • [Here is a SO answer](http://stackoverflow.com/questions/1016896/how-to-get-screen-dimensions) that talks about it if that's what you mean. That post is a little old and it seems like there's a better way of doing it but I will have to look – codeMagic Jun 21 '13 at 00:27
  • well thank you, I was using already Sherlock Actionbar and the one in libary is auto fitting, So I figure it out there. Well thank you very much for letting me know about Theme.Dialog. I have really forgotten about it. – Tirolel Jun 21 '13 at 00:40