android-widget

Start MainActivity from AppWidget doesn't work

爷,独闯天下 提交于 2019-12-12 03:35:25
问题 I'm trying to launch my MainActivity from my AppWidget with pending intent but I can't figure out why it doesn't fire the intent. The widget has a ListView with up to 3 items, which is bind to a RemoteViewsService. I want to start my MainActivity when any of the rows is clicked. Can anyone tell me what I might done wrong? I already checked some related posts like this Launching an activity from an AppWidget, and even tried to run the sample from here https://github.com/commonsguy/cw

Deal with blank background layout for RecognizerIntent

别来无恙 提交于 2019-12-12 03:35:23
问题 i am newbie in to android studio and java. i am making an app using speech recognition. The app is working fine but i decided to look into this issue. STT dialog screen after button is pressed blank background layout if user pressed back or touch outside the STT dialog If user said something, the activity works ok. But if the user pressed back or touch outside the dialog. A blank layout is shown which i want to avoid. this STT activity will be called via widget and the app activity. STT

Code to add both checkbox and radiobutton in same listview in android?

我的未来我决定 提交于 2019-12-12 03:22:37
问题 I need to add a Checkbox to Listview. How would I add radio buttons and checkboxes to the same listview using android? 回答1: You should make your own List Adapter, something like this: public class RadioCheckAdapter extends BaseAdapter{ private final RadioCheck[] radiochecks; RadioCheckAdapter(RadioCheck... radiochecks) { this.radiochecks = radiochecks; } ... @Override public View getView(int position, View convertView, ViewGroup parent) { ViewGroup item = getViewGroup(convertView, parent);

Read txt file in app Widget

纵饮孤独 提交于 2019-12-12 02:55:28
问题 I need read txt file in app Widget. I create txt in external set activity with name "NASTAVENI": @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.set); editor=(EditText)findViewById(R.id.editor); Button btn=(Button)findViewById(R.id.close); btn.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { phoneNo = editor.getText().toString(); finish(); } }); } public void onResume() { super.onResume(); try { InputStream in

Prevent a widget from getting clicked multiple times in a short span

痴心易碎 提交于 2019-12-12 02:39:58
问题 I have a button that when clicked, saves a canvas to an image file and then calls another activity. The problem I am having is that through testing, I've noticed the user can click the button twice in a row before the activity is called, resulting in two files being written. I also noticed the same problem with spinners in another activity. I click them twice in a row in succession and up pops up 2 list views containing all my spinner items. I've been trying to Google this without much luck.

android - widget AlarmManager repeating too fast

心已入冬 提交于 2019-12-12 02:03:50
问题 I have a widget which shows the data usage, for this I have created a PreferenceActivity where the user can choose from various update frequencies.. I get the chosen freq value from SharedPreferences and with that I start an alarm but I get weird result. Here is my AppWidgetProvider: private static PendingIntent pendingIntent = null; ... public void onReceive(Context context, Intent intent) { Log.d("TAG", "receive"); super.onReceive(context, intent); if (CLOCK_WIDGET_UPDATE.equals(intent

Android - ListView items inside app widget not selectable

佐手、 提交于 2019-12-12 01:56:57
问题 I have built a collection app widget for my Android app. The widget consists of a toolbar and then a ListView of tasks (it's a todo-list). The problem is the ListView doesn't show dividers between items and also the items themselves aren't selectable. My code is as follows: My agenda_app_widget.xml <?xml version="1.0" encoding="utf-8" ?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent">

Showing Terms and Conditions for first time in an android app

让人想犯罪 __ 提交于 2019-12-12 01:52:16
问题 I am developing an android app in which the first screen is the splash screen. If the user is a first time user(meaning the app was just installed) I have to show the terms and conditions otherwise, I have to show the login screen. How to get the number of times the application was opened or an indication that the app is opened for the first time? Is there any API for it? 回答1: You don't need to have this counter: SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context)

Android App Widget with scrollable content similar to Google Offers app

僤鯓⒐⒋嵵緔 提交于 2019-12-12 01:49:40
问题 I'm creating a widget for my app, with several content sections, and I would like the user to be able to scroll through them in the home screen widget - not in a scrollable TextView , but with each paragraph as its own section, like the widget for the Google Offers app: 回答1: That looks like a StackView widget, available for app widgets as of API Level 11. 来源: https://stackoverflow.com/questions/11868932/android-app-widget-with-scrollable-content-similar-to-google-offers-app

How to implement simple zoom for static map with pin buttons (ImageButtons)?

百般思念 提交于 2019-12-12 01:37:14
问题 One of the activities in my app needs to display a static map (a local png file) with pre-determined map pin locations. The static map is 480 px x 904 px in size, and I have implemented it with a scrollview so that I can scroll up and down to view the map and its various pin locations. The pins are implemented as ImageButtons (created programmatically instead of using xml), and clicking them will launch other corresponding new activities. I would like to know how to implement a simple zoom