Go Back   Android Forums > Android Discussion > Android Lounge
Android Lounge A place for general Android discussion and questions.

test: Reply
LinkBack Thread Tools
Old September 4th, 2012, 06:51 AM   #1 (permalink)
New Member
Thread Author (OP)
Join Date: Sep 2012
Posts: 1
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Question Problem showing an Activity as Dialog without Title & as an Activity too

I have an Activity (ExpandListActivity) which in one cas want to show as a Dialog and in other situation want to show as an Activity. The layout of ExpandListActivity has a TextView & ExpandList in a LinearLayout. When I show it as Dialog I want to remove the TitleBar & TextView from the layout, otherwise want both of them.
I tried setting Theme of ExpandListActivity as Dialog in manifest file, but then am not able to set the theme back to normal when am showing it as an Activity.
I removed Dialog Theme from manifest, and added requestWindowFeature (Window.FEATURE_NO_TITLE);, for the Dialog case, this gives me RuntimeException on this line. Added code to remove the TextView, but that also doesn't work.
My code is as follows :
ExpandListActivity is the Activity that I want to call as a Dialog &/or as an Activity :
@Overridepublic void onCreate(Bundle savedInstanceState) { 
Intent sender = getIntent();
boolean fDialogMode = sender.getBooleanExtra("dialogMode", false);
Log.i("ELA", "For Dialog : " + fDialogMode);
// If in Dialog mode, 
if (fDialogMode) {
} else {

//TextView tv = (TextView) findViewById(R.id.expandListTitle);
if (fDialogMode) {
} else {
ViewGroup vg = (ViewGroup) findViewById(R.id.lldata);
//vg.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
ViewGroup.inflate(ExpandListActivity.this, R.layout.expand_list_layout, vg);
//TextView tv = (TextView) vg.findViewById(R.id.expandListTitle);
Activity from which I call it as an Activity :
Intent intent1 = null;
intent1 = new Intent(Mumbai77Activity.this, HelplineActivity.class);
intent1.putExtra("dialogMode", false);
intent1.putStringArrayListExtra("lines", lines);

Activity from which I call it as a Dialog :

Intent intent1 =new Intent(PincodesActivity.this, ExpandListActivity.class);
intent1.putExtra("dialogMode", true);
intent1.putStringArrayListExtra("lines", lines);

Can anyone help me out with this problem. Am stuck from 2 days with this problem. Any help is highly appreciated. I am new in this forum, not used to posting code here, so maybe some code is not in proepr format.

AllTimeProg is offline  
Reply With Quote
sponsored links
activity, android, dialog, show, show activity

Go Back   Android Forums > Android Discussion > Android Lounge
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

All times are GMT -5. The time now is 08:04 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.