String text = "!re\n=.id=*1\n=.nextid=*2\n=name=script1\n=owner=admin\n=policy=ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api\n=run-count=0\n=source=\n=invalid=true";
Pattern p = Pattern.compile("^.*?name=(.*?)$", Pattern.MULTILINE);
Matcher m = p.matcher(text);
while (m.find())
{
System.out.println(m.group(1));
}
это понятно, параметр типа интерфейса сужается от T до конкретного Employee или Hourly. Но разве компилятор не сотрёт их?
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#00000000" />
<stroke
android:width="5dp"
android:color="#FFFF0000" />
</shape>
Drawable d[] = new Drawable[] { new ColorDrawable(0xFF00FF00), getResources().getDrawable(R.drawable.shape) };
findViewById(R.id.text).setBackgroundDrawable(new LayerDrawable(d));
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<stroke
android:width="5dp"
android:color="#FFFF0000" />
</shape>
ContextThemeWrapper contextThemeWrapper = new ContextThemeWrapper(this, android.R.style.Theme_Holo);
Spinner spinner = new Spinner(contextThemeWrapper);
CharSequence[] entries = getResources().getStringArray(R.array.spin);
if (entries != null)
{
ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(contextThemeWrapper, android.R.layout.simple_spinner_item, entries);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
}
root.addView(spinner, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
ViewGroup root = (ViewGroup) findViewById(R.id.root);
ContextThemeWrapper contextThemeWrapper = new ContextThemeWrapper(this, android.R.style.Theme_Holo);
LayoutInflater.from(contextThemeWrapper).inflate(R.layout.spinn, root, true);