android-background

Android Drawable color runtime

旧城冷巷雨未停 提交于 2021-02-11 12:15:46
问题 I am developing an android app. I have two different text view with different text view as shown in below two images: Text view one: Text view Two: I have a question, should I create two different drawable files with different colors or should I create a single drawable file and change the color runtime? What's the standard way to achieve this? If I should create a single drawable file then how should I change to color programmatically? 回答1: try this simple example public class MainActivity

Fetch location from android in background in flutter

允我心安 提交于 2021-02-07 10:50:09
问题 I am using below code to get the track the location of user. This works proper when my application in foreground. But when my application move to background it stop working and i can not get any location. import 'dart:async'; import 'package:permission_handler/permission_handler.dart'; import 'package:geolocator/geolocator.dart'; class FetchLocation { var geolocator = Geolocator(); var locationOptions = LocationOptions(accuracy: LocationAccuracy.high, distanceFilter: 10

Gray out fragment in background

人走茶凉 提交于 2020-01-13 06:31:26
问题 I have one main Fragment which is in the background when the second Fragment gets called with getFragmentManager().beginTransaction().add . Right now the user can see the main Fragment behind the second Fragment like it should be. But i want it to be like in a grayed look. When the Second Fragment gets called, the main Fragment should gray out. Im not sure what to google (have tried a lot of keywords) to describe this. My idea was to take a screenshot of the main fragment (bitmap) and make it

AlarmManager Stops after removing app from recents apps

廉价感情. 提交于 2020-01-02 20:44:20
问题 I am new to this part of android, and here I aim to use alarm manager to run a code snippet every 2 minute which will poll a server (using the website's api) and based on the returned JSON generate notification. After a looking up the web I thought one of the best option in my case will be using intent service and android. Manifest of Services and Recievers <service android:name=".NotifyService" android:enabled="true" android:exported="false" > </service> <receiver android:name=".TheReceiver"

Update data in Background Periodically (Android)

非 Y 不嫁゛ 提交于 2019-12-31 03:00:39
问题 The main objective of my app is, when a button is pressed: Collect data from the sensors Store data in the database Repeat periodically (every X seconds) I want to have it done in background, and if the Main Activity is destroyed, the background progress to be still running. So if you delete the activity, I want it still running. What I am doing right now, is having an AlarmManager with an Intent Service , to set the periodic recording of the Data, but whenever I destroy the Activity , as

finish background activity from broadcast receiver

狂风中的少年 提交于 2019-12-25 07:40:04
问题 I launch a new activity "ActivityB" when keypad is locked.(ActivityA has been backgrounded before the keypad is locked). ActivityB times out after 30 secs and supposed to close itself, so I called finish after 30 secs, though is not visible, after I unlock I see 2 seperate apps/activities in background. So I used Intent.ACTION_USER_PRESENT broadcastreceiver to finish activityB, still it doesnt work. Manifest.xml <receiver android:name="com.example.reciever.UnlockReceiver"> <intent-filter>

Android Dash/doted line issue?

随声附和 提交于 2019-12-23 07:36:36
问题 When I am using android dotted line its working fine in Small screens , but not working in Samsung S3 device and higher versions . Screenshots And drawable/dashline.xml <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="line" > <stroke android:dashWidth="20sp" android:dashGap="20sp" android:width="2dp" android:color="#FF0000" /> </shape> XML <ImageView android:id="@+id/button1" android:layout_width="fill_parent" android

Android Dash/doted line issue?

瘦欲@ 提交于 2019-12-23 07:34:11
问题 When I am using android dotted line its working fine in Small screens , but not working in Samsung S3 device and higher versions . Screenshots And drawable/dashline.xml <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="line" > <stroke android:dashWidth="20sp" android:dashGap="20sp" android:width="2dp" android:color="#FF0000" /> </shape> XML <ImageView android:id="@+id/button1" android:layout_width="fill_parent" android

Android: Background image resize on keyboard pop up

送分小仙女□ 提交于 2019-12-20 10:22:04
问题 I am developing an application in which the background image get shrink on keyboard pop-up. My .xml is as follows : <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:facebook="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/background" > <ScrollView android:layout_width="fill_parent" android:layout_height="fill_parent" >