Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6683239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:47:52+00:00 2026-05-26T04:47:52+00:00

I want an application in android without any GUI or activity. In my case,

  • 0

I want an application in android without any GUI or activity. In my case, I will show just a custom toast message that is my requirement. I am giving my code snippet, that is showing done but with no desired result.

Manifest file is

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="rit.utility"
  android:versionCode="1"
  android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />

<application android:icon="@drawable/icon" android:label="@string/app_name">
   <service android:enabled="true" android:name="MyService"></service> 
    <receiver android:enabled="true" android:name="MyIntentReceiver">       
    <intent-filter>         
    <action android:name="MY_INTENT" />       
    </intent-filter>     
    </receiver> 
</application>    

Receiver Class is

    public class MyIntentReceiver extends BroadcastReceiver
{
    @Override
    public void onReceive(Context _context, Intent _intent)
    {
        if(_intent.getAction().equals("MY_INTENT"))
        {
        _context.startService(new Intent(_context, MyService.class)); 
        }
    }
}

Service class is

    public class MyService extends Service
{
        private final IBinder mBinder = new MyBinder();
        public void onCreate()
        {
            super.onCreate();
            createToast();
        }
        public void createToast()
        {
             TextView textView = new TextView(this);
             textView.setBackgroundColor(Color.GRAY);
             textView.setTextColor(Color.BLUE);
             textView.setPadding(10,10,10,10);
             textView.setText("Textview as Toast");
             /** Create a Toast to display a View.
             * Here we are going to display a TextView.
             * Toast setView() is used to display a View.
             * Toast Display Duration is Long. So it will display for long time.
             * Toast setGravity() is used to set position to display the toast. */
             Toast toastView = new Toast(this);
             toastView.setView(textView);
             toastView.setDuration(Toast.LENGTH_LONG);
             toastView.setGravity(Gravity.CENTER, 0,0);
             toastView.show();
       }

        @Override
        public IBinder onBind(Intent intent)
        {
            // TODO Auto-generated method stub
            return null;
        }
        public class MyBinder extends Binder
        {
            MyService getService()
            {
                return MyService.this;
            }
        }

}

please help me where am I making mistake for showing custom toast???

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:47:53+00:00Added an answer on May 26, 2026 at 4:47 am

    Do you sure service class that MyService is started or created??

    when you want to start the service, you must make sure the MyIntentReceiver is toggled,
    there is a way you can try :
    you can set following code in you Manifest.xml

     <receiver android:name=".MyReceiver">
             <intent-filter>
                <action android:name="android.intent.action.AIRPLANE_MODE" />
            </intent-filter>
     </receiver>
    

    run your app; then change your device is Airplane mode, you will find your service is created;

    of course you can use another way to toggle the receiver;

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create an application for Android that will be able to scan
I want to build an notepad-style application on android that will have syntax highlighting.
In my android application I want to create a custom type of IM that
I'm working on an Android application that will send MMS internally without using the
I want to connect to Picasa from an Android application (without interacting with any
I want to write an application for Android devices that interacts with the surface
I want to make an android application that shows a listing of applications (downloaded
I'm writing an Android application that I want to be able to send requests
i want to create such application in android which will be activated when i
I have a Android 2.1 application with a WebView. In that WebView I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.