android-widget

How to hide bottom system bar in android tablet

≯℡__Kan透↙ 提交于 2019-12-05 11:11:17
I am developing an application for tablet only, where the requirement is to run the app on the full screen of the tablet. For this I have used following code in my main activity: getWindow().requestFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); This code snippet only removes the title bar and action bar. But in tablets, there is a bottom system bar (having home and back button). I also want to remove or hide this system bar too. I have searched but there is only following solution: There is no API

Debugging Widget causes ANR

你说的曾经没有我的故事 提交于 2019-12-05 11:02:57
I'm trying to debug an AppWidget but I incurred in a problem :D If not setting the breakpoint the widget works without ANR and the commands Log.v are executed flawlessly. Then I placed a breakpoint on the top of the method: public void onReceive(Context context, Intent intent) { Log.v(TAG, "onReceive 1"); // BP on this line super.onReceive(context, intent); String action = intent.getAction(); // Checks on action and computations ... Log.v(TAG, "onReceive 2"); updateWidget(context); Log.v(TAG, "onReceive 3"); } The breakpoint stops the execution as expected but then the process dies. The

Custom Position of Hint in Edit Text box.

风流意气都作罢 提交于 2019-12-05 10:58:52
问题 I was wondering if there was any way that I could get a hint at the bottom of an Edit Text view -- and then the user to start entering text at the top of the box. As a bonus question, is there any way I can make the hint NOT disappear once the user starts entering text. 回答1: You can set the position of the text using the "gravity" attribute (as noted at http://developer.android.com/reference/android/widget/TextView.html#setGravity(int)). So to put the text at the bottom you would have;

How to call a 'method' defined in another activity on click of a widget button? [closed]

陌路散爱 提交于 2019-12-05 10:43:30
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 5 years ago . I know how to launch an activity on click of widget button using pending intent but I want to launch a particular method of that activity. 回答1: If you need to call a method in another activity then you're following a wrong design. You should not put all of your code in the activities alone. Why it

Having Trouble with Soft Keyboard

☆樱花仙子☆ 提交于 2019-12-05 10:37:28
Hi Everyone iam new to Android and stuck in really silly problem in my project i have one EditText which is defined in Header View of a List View whenever users touches the EditText soft keyboard will be displayed. i have something called clear button which clears the EditText After clearing soft keyboard is not displaying in 2.3 devices.Whenever i press lock/power button lock the device and unlock then soft keyboard is displaying <activity android:name=".pl.Mobile.AddJobNew" android:configChanges="orientation|keyboardHidden" android:screenOrientation="landscape" android:windowSoftInputMode=

Relative Layout ignoring setMargin()

余生颓废 提交于 2019-12-05 10:32:37
问题 I'm trying to nest a RelativeLayout inside of a LinearLayout , and give the RelativeLayout a margin that spaces it's edges away from the edges of the LinearLayout . So far I have this: LayoutInflater.from(context).inflate(R.layout.conversation_view_layout, this, true); this.setLayoutParams(new MarginLayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); int tbm = AllConversationsActivity.topAndBottomMargin; int lrm = AllConversationsActivity.leftAndRightMargin; (

Dynamically adding a View to an android widget

旧城冷巷雨未停 提交于 2019-12-05 10:03:56
I am programmically creating a view at runtime and I want to this view to be added to my linearlayout dynamically at runtime. Here is the code I got: public class Widget extends AppWidgetProvider { @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { RemoteViews updateViews = new RemoteViews(context.getPackageName(), R.layout.main); DemoView dv = new DemoView(context); // Stuck here...How do I add my new dv View to my android widget appWidgetManager.updateAppWidget(appWidgetIds, updateViews); super.onUpdate(context, appWidgetManager,

How to programmatically disable onClick handler on Android AppWidget Button

允我心安 提交于 2019-12-05 09:17:26
I have a Button on appwidget, that I need to 'enable'/'disable' programmatically from a Service. First idea was to call setBoolean(R.id.buttonid, "setClickable", false) to disable it, but apparently you can't call setClickable remotely. Another idea was was remove the text label from it with rv.setTextViewText(R.id.buttonid, "") and then remove the click handler by rv.setOnClickPendingIntent(R.id.buttonid, null) . Unfortunately passing null to it causes NullPointerException in in android.app.ActivityThread.handleServiceArgs Is there some other way to programmatically disable/enable appwidget

Custom view object using up full height of screen even when layout_height is set to wrap_content

半世苍凉 提交于 2019-12-05 08:28:11
I created an object that extends android.view.View , overriding draw() and have it displaying on the screen. To put you in the picture, it is a display of digits to represent a game score. It's displaying correctly horizontally, however, it is taking up the full height of the screen - pushing all other elements off the screen. I've put layout_height="wrap_content" in the xml, but it has no effect. Does anyone know what I am doing wrong? I've figured it out... I was supposed to override onDraw() but that wasn't what caused the problem. The main thing was, I needed to override onMeasure() like

Token Edittext (Field) android

对着背影说爱祢 提交于 2019-12-05 07:55:17
问题 Because some reason I need a Edittext like the red part in this image : Whenever the user press delete button on keyboard, the edittext will delete one token instead of one word. So, my question are : Do we have an exist control like it? or If not, do you know how can customize one. Note : I don't need it the same 100%. Right now, I am thinking about using a TextWatcher or setKeyListener method for delete feature. Thank you so much for any help. And sorry because my English is not really well