Note that there are some explanatory texts on larger screens.

plurals
  1. POMethod onHandleIntent() does not get called
    primarykey
    data
    text
    <p>After many hours of researching I am finally consulting official help. Why does not <code>onHandleIntent()</code> get called? Is there something wrong here?</p> <p>In main activity <code>onCreate()</code>:</p> <pre><code>mService = new Intent(context, xyz.class); startService(mService); </code></pre> <p>That iss it. The <code>onStartCommand()</code> gets called, but not <code>onHandleIntent()</code></p> <pre><code>package com.autoalbumwallaperplus; import android.app.IntentService; import android.content.Intent; import android.widget.Toast; public class xyz extends IntentService { public xyz() { super("bmp"); } @Override public int onStartCommand(Intent intent, int flags, int startId) { Toast.makeText(this,"onStartCommand works!", Toast.LENGTH_SHORT).show(); return super.onStartCommand(intent,flags,startId); } @Override protected void onHandleIntent(Intent workIntent) { Toast.makeText(this,"onHandleIntent works!", Toast.LENGTH_SHORT).show(); } } </code></pre> <p>This is inside the OnHandleIntent</p> <pre><code> String imagepath = workIntent.getStringExtra("String"); Toast.makeText(this, "it works" , Toast.LENGTH_SHORT).show(); DisplayMetrics displayMetrics = new DisplayMetrics(); WindowManager hi = ((WindowManager) getBaseContext().getSystemService(Context.WINDOW_SERVICE)); int height = displayMetrics.heightPixels; int width = displayMetrics.widthPixels &lt;&lt; 2; // ... First decode with inJustDecodeBounds=true to check dimensions final BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; Bitmap decodedSampleBitmap = BitmapFactory.decodeFile(imagepath, options); // ... Calculate inSampleSize options.inSampleSize = calculateInSampleSize(options, width, height); // ... Decode bitmap with inSampleSize set options.inJustDecodeBounds = false; decodedSampleBitmap = BitmapFactory.decodeFile(imagepath, options); // ... Set Wallpaper //Context context = getApplicationContext(); WallpaperManager wm = WallpaperManager.getInstance(this); try { wm.setBitmap(decodedSampleBitmap); } catch (IOException e) { } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload