代码如下:
1.清单文件里面配置:
<activity
android:name=".InnerActivityTest$InnerActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
2.Java文件里面:
public class InnerActivityTest {
public static class InnerActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView textView = new TextView(this);
textView.setText("吃葡萄不吐葡萄品");
textView.setTextColor(getResources().getColor(R.color.black));
setContentView(textView);
}
}
}
3.启动方法;
Intent intent = new Intent(this, LocalServiceActivities.Controller.class);
终上所述,这是谷歌APiDemos里面的示例写法,不推荐用。
网友评论