Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

(AppCompat) Activity without UI

As per this post, I know I am allowed to create an activity that has no user interface by declaring your activity like below:

<activity
    android:name=".NoUIActivity"
    android:theme="@android:style/Theme.NoDisplay">
</activity>

My problem is NoUIActivity extends AppCompatActivity. If I use the android:theme line above, it gives me error saying I should use the corresponding AppCompat theme. Help please. Thanks!

like image 345
user1506104 Avatar asked Nov 17 '22 12:11

user1506104


1 Answers

Your activity should look like:

public class NoUIActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        setContentView(R.layout.activity_no_uiactivity);
    }
}

And in AndroidManifest.xml declare activity like:

<activity
            android:name=".NoUIActivity"
            android:theme="@android:style/Theme.Translucent.NoTitleBar"
            android:exported="false" />
like image 73
Amol Desai Avatar answered Dec 17 '22 03:12

Amol Desai