Hello, 

   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 : 


@Override
> public 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) {
> this.requestWindowFeature(Window.FEATURE_NO_TITLE);
> } else {
> super.setTheme(android.R.style.Theme);
> }*/
>
>
> super.onCreate(savedInstanceState);
>
> //setContentView(R.layout.expand_list_layout);
>
> //TextView tv = (TextView) findViewById(R.id.expandListTitle);
>
> if (fDialogMode) {
> requestWindowFeature(Window.FEATURE_NO_TITLE);
> setContentView(R.layout.expand_list_layout); 
> } 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);
> //tv.setText("Helpline");
>
              }

>
> }
>



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);
> startActivity(intent1);
>



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);
startActivity(intent1);



Can anyone help me out with this problem. Am stuck from 2 days with this 
problem. Any help is highly appreciated. Can't get any possible workout 
that solves both the issues and lets me use the Activity as a Dialog and as 
an Activity taking care of the TextView.

Thanks

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to