Alert Dialog vs Dialog vs ?

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Alert Dialog vs Dialog vs ?

Postby avolovoy » Tue Nov 04, 2008 7:58 pm

Hi All, i'm trying to build an about screen for my application which should have title with icon and body with custom view. By custom, i mean i want to change background, fonts, get some urls in and couple of buttons.
So basically AlertDialog type of the window will work but i need to customize the body. So, having my layout defined in xml i'm trying the following:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  private void onAbout() {
  2.  
  3.         final Builder winAlert;
  4.  
  5.         Dialog winDialog;
  6.  
  7.  
  8.  
  9.         OnClickListener okListener = new OnClickListener() {
  10.  
  11.             // @Override
  12.  
  13.             public void onClick(DialogInterface dialog, int which) {
  14.  
  15.                 dialog.cancel();
  16.  
  17.                 return;
  18.  
  19.  
  20.  
  21.             }
  22.  
  23.         };
  24.  
  25.  
  26.  
  27.         winAlert = new AlertDialog.Builder(this).setIcon(R.drawable.icon)
  28.  
  29.                 .setTitle("My title").setPositiveButton(
  30.  
  31.                         "Ok", okListener);
  32.  
  33.         winDialog = winAlert.create();
  34.  
  35.  
  36.  
  37.         // winAlert.setCanceledOnTouchOutside(true);
  38.  
  39.         // winDialog.setContentView(R.layout.about);
  40.  
  41.         // winDialog.addContentView(findViewById(R.layout.about),
  42.  
  43.         // new LayoutParams(LayoutParams.FILL_PARENT,
  44.  
  45.         // LayoutParams.FILL_PARENT));
  46.  
  47.         winDialog.show();
  48.  
  49.  
  50.  
  51.     }
Parsed in 0.033 seconds, using GeSHi 1.0.8.4

it works until i do set content view to it , and after i do it's crashes ( never mind commented code i was trying different things). When i'm trying just use the Dialog , i'm losing control over the title ( i mean i can't add / change icon ).
So what should i do here ? I mean I can go towards creating AboutWindow and extending Dialog and set content in onCreate, but it feels like an overkill
Alexey Volovoy
Bytesharp.NET
User avatar
avolovoy
Experienced Developer
Experienced Developer
 
Posts: 68
Joined: Mon Nov 03, 2008 10:32 pm
Location: kansas

Top

Postby avolovoy » Tue Nov 04, 2008 8:24 pm

Ok this seemed to work
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.        
  2.  
  3. LayoutInflater li = LayoutInflater.from(this);
  4.  
  5.         View view = li.inflate(R.layout.about, null);
  6.  
  7.  
  8.  
  9.         winAlert = new AlertDialog.Builder(this).setIcon(R.drawable.icon)
  10.  
  11.                 .setTitle("Smart Tac Toe by Mobile Dynamix")
  12.  
  13.                 .setPositiveButton("Ok", okListener).setView(view);
  14.  
  15.  
Parsed in 0.032 seconds, using GeSHi 1.0.8.4

is there anything i can do about the title ( font/background wise ? )
Alexey Volovoy
Bytesharp.NET
User avatar
avolovoy
Experienced Developer
Experienced Developer
 
Posts: 68
Joined: Mon Nov 03, 2008 10:32 pm
Location: kansas

Postby MrSnowflake » Tue Nov 04, 2008 8:32 pm

I don't know about such options. Actually I hope you can't change too much about the title. It's supposed to be the same system wide, for the user to not get disoriented.
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby avolovoy » Tue Nov 04, 2008 8:34 pm

good point. i'll let title stay standard.
Alexey Volovoy
Bytesharp.NET
User avatar
avolovoy
Experienced Developer
Experienced Developer
 
Posts: 68
Joined: Mon Nov 03, 2008 10:32 pm
Location: kansas

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Exabot [Bot] and 7 guests