Android应用无法使用。 [英] Android app is not working .
本文介绍了Android应用无法使用。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在创建一个应用程序,启动一个覆盖按钮,当切换开关打开时,该覆盖按钮保持在所有其他活动之上。
我有以下三个班级在eclipse中没有显示错误。
MainActivity类 -
I am making an app which starts an overlay button which stays on top of all other activities when the toggle switch is on .
I have the following three classes with no errors shown in eclipse .
MainActivity class-
public class MainActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction().add(R.id.container, new PlaceholderFragment()).commit();
}
}
public void openOverlayButton(View view) {
// Is the toggle on?
boolean on = ((Switch) view).isChecked();
if (on) {
Intent intent = new Intent(this, TaskBarViewNew.class);
startActivity(intent);
} else {
// Disable overlay button
}
TaskBarViewNew class-
TaskBarViewNew class-
public class TaskBarViewNew extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent svc = new Intent(this , OverlayButtonActivity.class);
startService(svc);
finish();
}
OverlayBittonActivity只是一项单独工作的服务,但在这里它不起作用。我认为我在使用Intent时犯了一个错误。任何人都可以帮忙??
And the OverlayBittonActivity is just a service which works fine alone but here it is not working . I think I am doing a mistake in using Intent . Can anyone help??
推荐答案
这篇关于Android应用无法使用。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文