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 8845001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:37:48+00:00 2026-06-14T11:37:48+00:00

I would like to develop a widget for a existing android apps. The only

  • 0

I would like to develop a widget for a existing android apps.

The only function i want is to display the variable i get from the apps.
I have developed a simple function to get variable from it but i don’t know how to update it when the apps is closed.

Or i have to write a service to get these variable?

package hkcsl.tabbedactivealarm;

import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.RemoteViews;

public class AppWidgetExample extends AppWidgetProvider {   
@Override
public void onReceive(Context context, Intent intent) {

  super.onReceive(context, intent);     
  RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.helloworld);
  String value1 = intent.getStringExtra("Value"); 
  views.setTextViewText(R.id.text, value1);
  AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
  appWidgetManager.updateAppWidget(new ComponentName(context, AppWidgetExample.class), views);
   }
  }
  • 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-06-14T11:37:50+00:00Added an answer on June 14, 2026 at 11:37 am

    if i understand the question –

    Yes, it’s possible, but i believe that the update interval must be less frequent than once per minute. refer to this guide for a simple tutorial:

    http://www.vogella.com/articles/AndroidWidgets/article.html#simplewidget

    Yeah, your app needs a process that runs while your app is closed. so a background service or an AsyncTask or Thread would do. Background Service is your best choice

    edit

    okay i think i undersatnd better now. using that same link above, read section 4.

    `appWidgetManager.updateAppWidget(widgetId, remoteViews);`
    

    you only start 1 service, and the service takes care of updating values. if you want something special to happen upon the user exiting your app, you can override onDestroy()?

    edit 2

    use something like this in the XML:

    <?xml version="1.0" encoding="utf-8"?>
    <appwidget-provider 
          xmlns:android="http://schemas.android.com/apk/res/android"
        android:initialLayout="@layout/YOUR_LAYOUT"
        android:minHeight="72dp"
        android:minWidth="300dp"
        android:updatePeriodMillis="300000" >
    
    </appwidget-provider> 
    

    notice the updatePeriodMillis=300000

    this was taken from section 3 of that article link above

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

Sidebar

Related Questions

I would like to develop an Android application which will have a local database.
I would like to develop a game on Android platform, I have about a
I would like to develop or use an existing platform that will allow me
I would like to develop some apps for the JVM using a concise, dynamic
I would like to develop Mac applications, but don't want to use XCode. I
I would like to develop a Forum from scratch, with special needs and customization.
I am trying to develop a custom widget for camera preview. I would like
I would like to develop a browser extension for all major browsers. From what
I would like to develop OpenGL ES 2.0 apps on my Ubuntu machine. I
I would like to develop a system, where user will get the data dynamically(what

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.