android-widget

Loading web pages in webview in android?

ε祈祈猫儿з 提交于 2019-12-08 03:56:45
问题 i have a link for example,"http://google.com" , i need to load the web page in to my app either in web view or some other View, but not in default Browser of android , whether it is possible or not. Thanks 回答1: I think you want to load URL in webview within the application . If i am not wrong, then you can have: WebView browser = (WebView)findViewById(R.id.browser); browser.setWebViewClient(new WebViewClient() { /* On Android 1.1 shouldOverrideUrlLoading() will be called every time the user

OutOfMemoryError in android application

本小妞迷上赌 提交于 2019-12-08 03:56:34
问题 I have asked for help about OutOfMemoryError problem in my android app before. Since I have not had a solution yet i need to ask you again to advice me a solution. I tested my app in several real android devices. But in Samsung Galaxy S3 android 4.0.4 I have OutOfMemoryError problem. Logcat messages are below. Thank you. 07-13 10:42:23.820: E/AndroidRuntime(2065): FATAL EXCEPTION: main 07-13 10:42:23.820: E/AndroidRuntime(2065): java.lang.OutOfMemoryError 07-13 10:42:23.820: E/AndroidRuntime

is there any “onCreate” method for Android widgets?

怎甘沉沦 提交于 2019-12-08 02:51:36
问题 I'm following this tutorial for adding EULA to my Android application, but i have two problems: 1) My app is based on widget and i would like to show my EULA as soon as widget is started. Is there any "onCreate" method for widgets? 2) If user refuse EULA, i would like to close my app. I'm C# programmer, so i don't know if there's any "Exit()" method for Android apps. How to forcefully close my app without user's action? 回答1: There isn't an onCreate() per se, but there is a way to show an

java.lang.RuntimeException: Unable to Instantiate activity ComponentInfo

淺唱寂寞╮ 提交于 2019-12-08 02:43:21
问题 I am creating a widget but when I run it I get this error in the console: [2013-10-05 22:02:56 - AwesomeFileBuilderWidget] ------------------------------ [2013-10-05 22:02:56 - AwesomeFileBuilderWidget] Android Launch! [2013-10-05 22:02:56 - AwesomeFileBuilderWidget] adb is running normally. [2013-10-05 22:02:56 - AwesomeFileBuilderWidget] No Launcher activity found! [2013-10-05 22:02:56 - AwesomeFileBuilderWidget] The launch will only sync the application package on the device! [2013-10-05

Android: Clickable TextView with Linkified links

时间秒杀一切 提交于 2019-12-08 02:09:59
问题 I have a TextView in my layout which has an attribute "clickable=true" set in XML. This is to allow it behave like a button with both text and icon. Now, I add to that TextView HTML text via call HTML.fromHtml(), and apply Linkify.addLinks after that. The problem is: in such configuration, links are not clickable. Is there any suggestion, how to allow user click on links, other from creating custom TextView-based class? Thanks 回答1: try add an attribute "android:autoLink="web"" to the textview

How to Implement the ImageAdapter for this listView Code?

ぐ巨炮叔叔 提交于 2019-12-08 02:01:20
问题 Code of List View is like: public final static String ITEM_TITLE = "title"; public final static String ITEM_CAPTION = "caption"; public Resources resources; public static Uri path; public static File file; public static ProgressDialog m_progressDialog; public static ListView list; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); // create our list and custom adapter SeparatedListAdapter adapter = new SeparatedListAdapter(this); adapter

How to customize style from spinner dropdown CHOICES?

谁说胖子不能爱 提交于 2019-12-08 01:06:00
问题 I can customize the background of the selected option on a spinner dropdown using: <item name="android:spinnerStyle">@style/customSpinner</item> <style name="customSpinner" parent="@android:style/Widget.Holo.Light.Spinner"> <item name="android:textColor">#000000</item> <item name="android:background">#000000</item> </style> But I can't manage to change the background and textcolor of the list of options that the dropdown has. How do I achieve that? 回答1: adapter.setDropDownViewResource(R

Simple way To Update Widget TextView Periodically

被刻印的时光 ゝ 提交于 2019-12-07 23:50:48
问题 I have a widget with two TextView showing the time and date. I simply want this batch of code to happen every second: views.setOnClickPendingIntent(R.id.rl, pendingIntent); java.util.Date noteTS = Calendar.getInstance().getTime(); String time = "kk:mm"; String date = "dd MMMMM yyyy"; views.setTextViewText(R.id.tvTime, DateFormat.format(time, noteTS)); views.setTextViewText(R.id.tvDate, DateFormat.format(date, noteTS)); So I need a simple way to update TextView periodically in the widget so

How to give the static value to HashMap?

若如初见. 提交于 2019-12-07 23:14:20
问题 I have HashMap like: static HashMap<String,ArrayList<Media>> mediaListWithCategory=new HashMap<String,ArrayList<Media>>(); I have value like: January: -Sunday -Monday Februsry: -Saturday -Sunday -Thursday March: -Monday -Tuesday -Wednesday How can I statically assign these values when defining the hash map? 回答1: You can populate it in a static block: static { map.put("January", Arrays.asList(new Media("Sunday"), new Media("Monday"))); } (You should prefer interface to concrete classes. define

How to detect if a widget is on/off screen?

拥有回忆 提交于 2019-12-07 18:20:34
I'm writing a customized view similar to Grid which will be used to hold a large amount of images. I'm using ImageButton to display the images, and I only want to load images onto the buttons once they are on the screen (and just display a static background image when they are not). The reason for it is that I'm fetching images from some back-end service and I only want to fetch them when the buttons are on the screen. To do that, I'd like to know if the widget is on the screen. Is it possible to detect if a widget like button is on/off screen? If not, any suggestions on how to achieve what I