All pastes #2065674 Raw Edit

Something

public text v1 · immutable
#2065674 ·published 2011-05-20 13:15 UTC
rendered paste body
private void showSkadeType()
    {
    	AlertDialog.Builder builder = new AlertDialog.Builder(BeskrivActivity.this.getParent());
    	builder.setTitle("Skadetype");
    	
    	int checkedIndex = -1;	
    	for (int i=0; i<radioVariants.length; i++)
        {
    		boolean selected = (skadeType != null && skadeType.equals(radioVariants[i]));
           	if (selected)
        		checkedIndex = i;
        }
    	
    	builder.setSingleChoiceItems(radioVariants, checkedIndex, new DialogInterface.OnClickListener() {
    	    public void onClick(DialogInterface dialog, int item) {
    	    	skadeType = radioVariants[item];
				   
				   ViewGroup typeGroup = (ViewGroup)findViewById(R.id.skadeTypePick);
	    		   TextView typeText = (TextView)typeGroup.getChildAt(1);
	    		   String printString = skadeType;
	    			  if (printString.length() > 18)
	    				  printString = printString.substring(0, 17).concat("...");
	    			  typeText.setText(printString);
    	    }
    	});
    	AlertDialog alert = builder.create();
    	alert.show();
    }