android-widget

Android Video View Thumbnail?

六月ゝ 毕业季﹏ 提交于 2019-12-05 02:09:13
问题 I have the video which is stored under specific folder in sdcard. Currently i have the path as only parameter(Ex:"sdcard/test/sample.mp4"), by using url alone is it possible to retrieve the thumbnail of the image. I also want to show the video preview display in android ,any one provide some example to do this thing. Thanks 回答1: ThumbnailUtils is an easy-to use API for generating thumbnails from arbitrary filesystem paths. It is available in API level 8. Check out ThumbnailUtils

OnClickListener() must override a superclass method?

ぐ巨炮叔叔 提交于 2019-12-05 02:07:23
With this code: import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; . . . Button buttonAuthorizeUsers = (Button) findViewById(R.id.buttonAuthorizeUsers); buttonAuthorizeUsers.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent configure = new Intent(OnDemandAndAutomatic_Activity.this, Configure_Activity.class); OnDemandAndAutomatic_Activity.this.startActivity(configure); } }); I'm getting: The method onClick(View) of type new

How to set this Layout that fit to Any Screen height?

北战南征 提交于 2019-12-05 02:00:11
问题 I have Some layout Problem regarding my Application. This is My Application Layout: <?xml version="1.0" encoding="utf-8"?> <ImageView android:layout_width="fill_parent" android:layout_height="wrap_content" android:src="@drawable/tax_calculator_logo"/> <LinearLayout android:layout_height="fill_parent" android:layout_width="fill_parent" android:orientation="vertical" android:layout_marginLeft="20dp" android:layout_marginRight="20dp" android:layout_gravity="center" android:layout_marginTop="10dp

PendingIntent to launch and stop a Service

旧时模样 提交于 2019-12-05 01:34:52
I'm trying to make a simple widget with a button that start a Service with the OnClickPendingIntent() . I can start it fine but I can't figure out a way to stop it (I know I can do it with a BroadcastReceiver or something similar but I would like to avoid hardcode). This is my code: Intent intent = new Intent(context, myService.class); PendingIntent pendingIntent = PendingIntent.getService(context, 0, intent, 0); RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.my_widget); if (!ismyserviceup(context)) { views.setOnClickPendingIntent(R.id.my_button, pendingIntent); } else

Android: How to clear an EditText by cross Button in the right side

你。 提交于 2019-12-05 00:46:21
I have created an EditText for search, which contains on the left side a search icon and on the right side of icon: <EditText android:id="@+id/Search" android:layout_width="250dp" android:layout_height="wrap_content" android:drawableLeft="@android:drawable/ic_menu_search" android:drawableRight="@android:drawable/ic_delete" android:hint="Search Product .." > </EditText> I want to know how can I clear the content of EditText when I click the cross button. Thank you in advance. Paul Verest An improved answer by @aristo_sh from Handling click events on a drawable within an EditText mQueryEditText

How can I add WebView into a Widget?

妖精的绣舞 提交于 2019-12-05 00:04:00
I'm trying to make a recording Widget where the user interface would be loaded from HTML page in WebView. Is this possible? I've been trying to load url into Widget but I get all sorts of errors and my program crashes. I'm new to Android development and don't really know how this stuff works yet. This is my Widget provider class: public class RecordAppWidgetProvider extends AppWidgetProvider { WebView webview; @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { webview.getSettings().setJavaScriptEnabled(true); webview.loadUrl("http://www

Homescreen widget, listView shows “Loading”

早过忘川 提交于 2019-12-05 00:01:28
To start off, an image says thousand words: This takes place although getViewAt is called 4 items as my cursor size is. Here's the code: public class WidgetService extends RemoteViewsService { @Override public RemoteViewsFactory onGetViewFactory(Intent intent) { System.out.println("Factory"); return(new WidgetViewsFactory(this.getApplicationContext(), intent)); } } The widget provider: public class WidgetViewsFactory implements RemoteViewsService.RemoteViewsFactory, LNTConstants { private Context context = null; ArrayList<DBItemModel> items; public WidgetViewsFactory(Context context, Intent

Start/Stop Service from Widget

*爱你&永不变心* 提交于 2019-12-04 23:56:54
问题 I want to start a service from inside the widget, I know that i can do it using PendingIntent like PendingIntent intent = PendingIntent.getService(context, 0, new Intent(context, MyService.class), Intent.FLAG_ACTIVITY_NEW_TASK); remoteViews.setOnClickPendingIntent(R.id.buttonWidgetStartService, intent); but the problem is that I've already used PendingIntent on that button for some other purpose. So, I tried starting the service using context.startService(new Intent(context, MyService.class))

Disable collapsing of ExpandableListView

不想你离开。 提交于 2019-12-04 22:46:43
The default behavior of ExpandableListView is to collapse a group when its header is clicked. Is it possible to prevent this from happening? I've tried: Setting OnTouchListener on the list. This interferes with scrolling. Setting an OnGroupClickListener on the list (in onCreate() ). This works for all clicks after the first. Has anyone else accomplished this? Why might the OnGroupClickListener miss the first click? Thanks in advance for your suggestions. You can ignore click on group items like this: mMyExpandableListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {

How to display Progressbar When data is loading from the web?

旧街凉风 提交于 2019-12-04 22:08:14
I am implementing progressbar in my android app. In my app i want to display progressbar when images are loading from the web after loading all images the loader should be stopped. I seen some example of progressbar in that it is displaying for predefined period of time. But i want the progressbar display dynamically depends on the time to load images from the web. You shoud use an AsyncTask . The Javadoc for it has an example of just what you want to do : private class DownloadFilesTask extends AsyncTask<URL, Integer, Long> { protected Long doInBackground(URL... urls) { int count = urls