android-widget

Can I add widgets from installed apps to my application activity

孤者浪人 提交于 2019-12-04 12:58:04
I am trying develop an android application for a device (device is not a tablet or phone, its a preconfigured android board running Android 4.1.1)and one of the activity need to display a customized dashboard of several types of information as shown below The types of information shown here is preconfigured. Instead of developing all these from scratch, I am planning to install apps that has widgets (like weather and calendar) and include widgets in my Layout. I refered to the below links Add widgets into my own application.- Android http://www.anddev.org/appwidgethost_tutorial-t10329.html I

Android Tabhost Problem - .setIndicator

二次信任 提交于 2019-12-04 12:37:44
First let me clarify that i have already referred the SO question related to "Android - TAbhost". I have done googling about "Android Tabhost" but failed to find the solution. My problem is: If are having <3 tabs then it is fine. but Supporse if we are having 4 tabs with indicator title as TabHost1, TabHost2, TabHost3, TabHost4). But this title in Tab does not get fitted with tab. so is there any way to fit the Title Text (i.e. indicator) inside the tab ?? I thought the source of our issue was somewhere in the framework's code. And sure enough, I found some clues : First, if you look inside

Static access to an Android app's resources?

六月ゝ 毕业季﹏ 提交于 2019-12-04 12:14:31
问题 I have a problem re. an Android application's resources: My application has misc. modes (edit/plan/exec), which I would like to describe using an enumeration type. I would, however, like to populate the enumeration-values with strings that stem from the resource string.xml file, i.e. instead of enum Mode { EDIT ("edit"), PLAN ("plan"), EXEC ("exec"); String name; Mode(String name) { this.name = name; } @Override public String toString() { return this.name; } }; I would like to write something

Android AppWidgetProvider's onReceive method never gets called

你。 提交于 2019-12-04 12:05:30
I'm working on an android widget. This is my AppWidgetProvider class: public class MyWidgetProvider extends AppWidgetProvider { public static String ACTION_CHARGE = "Charge"; public static String ACTION_BALANCE = "Balance"; public static String ACTION_SEND_BALANCE = "SendBalance"; public static String ACTION_CALL_ME = "CallMe"; @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { // Get all ids ComponentName thisWidget = new ComponentName(context, MyWidgetProvider.class); int[] allWidgetIds = appWidgetManager.getAppWidgetIds(thisWidget); for

Android TextView right alignment on a right-to-left device

好久不见. 提交于 2019-12-04 12:02:52
I am writing an app that displays in the Hebrew language and for that I am right aligning TextView's text. While developing on a Nexus device all works great and texts are displayed as it should, using the android:gravity="right" for TextView. When I am running the same app on a local mobile carrier device (Israel) which is running a custom ROM all TextView widgets that were set with gravity="right" are appearing as if they were set as gravity="left". If I go and change the gravity to left (you guessed it..) it will align right. I have tried changing the default locale of the device back to US

Draw an arc with a SweepGradient in Android

[亡魂溺海] 提交于 2019-12-04 12:01:28
问题 How can I draw an arc using a Shader such as SweepGradient? The examples I have all take a Paint object: Paint lightRed = new Paint(); lightRed.setAntiAlias(true); lightRed.setStyle(Style.STROKE); lightRed.setStrokeWidth(12); lightRed.setColor(0xFFCC0000); ... canvas.drawArc(rectf, -90, 360, false, lightRed); Don't think it makes a difference, but I'm using it to draw to a homescreen widget 回答1: Try this: Shader gradient = new SweepGradient (0,getMeasuredHeight()/2, Color.RED, Color.WHITE);

Top-most and Bottom-most Horizontal Divider does not show up in ListView

∥☆過路亽.° 提交于 2019-12-04 10:56:55
问题 I am using a ListView. But the top-most and bottom-most horizontal bar does not show up. Why? I am using this: android:divider="@android:drawable/divider_horizontal_bright" 回答1: Have you looked into setting android:headerDividersEnabled and android:footerDividersEnabled on the ListView ? Also, if you look for drawDivider in platform/frameworks/base/+/master/core/java/android/widger/ListView.java in the Android open source repository, you'll be able to find some more clues. 回答2: Add a dummy

R.id Cannot be resolved

∥☆過路亽.° 提交于 2019-12-04 10:43:51
I guess something should be done with the Android-Manifest.xml file or something in the layout folder. I am new to Android so I don't know what I should write. public class AndroidPong extends Activity implements OnClickListener { static String tag; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super .onCreate(savedInstanceState); tag = getResources().getString(R.string.app_name); fullScreen(); splashScreen(); } @Override protected Dialog onCreateDialog(int id) { // TODO Auto-generated method stub return super .onCreateDialog(id); } @Override

Accessing Layout Items from inside Widget AppWidgetProvider

半城伤御伤魂 提交于 2019-12-04 10:08:39
I am starting to go insane trying to figure this out. It seems like it should be very easy, I'm starting to wonder if it's possible. What I am trying to do is create a home screen widget, that only contains an ImageButton. When it is pressed, the idea is to change some setting (like the wi-fi toggle) and then change the Buttons image. I have the ImageButton declared like this in my main.xml <ImageButton android:id="@+id/buttonOne" android:src="@drawable/button_normal_ringer" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" /> my

Android onEnabled/onDisabled never called

别等时光非礼了梦想. 提交于 2019-12-04 10:04:22
I'm having a problem with triggering of the onEnabled and onDisabled methods of the AppWidgetReciever. I have the actions specified, I also log every action in onRecieve method, but the only two actions I get are "APPWIDGET_UPDATE" and "APPWIDGET_DELETED". I have googled for this solution, but unfortunately found none. Here is my code: Manifest part: <receiver android:name=".ScheduleWidgetProvider" > <intent-filter> <action android:name="android.appwidget.action.APPWIDGET_ENABLED" /> <action android:name="android.appwidget.action.APPWIDGET_DISABLED" /> <action android:name="android.appwidget