Menu
  • HOME
  • TAGS

How do I use the default android Button drawable as the background of another view?

android,android-layout,android-view,android-button,android-background

Have you tried to use Button's style like this. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" style="?android:attr/buttonStyle" android:id="@+id/linlay_add_category_area_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="10dp" android:orientation="horizontal" android:padding="13dp"> ... </LinearLayout> ...

Background Bitmap image in Activity?

android,android-layout,bitmap,android-background

To point out, image file size don't effect memory usage. It depend on the image specs: width x height x 1 byte. You shouldn't set splash screen image in code by scaling it depending on screen resolution. The drawable folders are there to do that. Provide a different image with...

Update data in Background Periodically (Android)

android,database,sqlite,android-intent,android-background

Try to start service in separate process using android:process=":servicename" in AndroidManifest.xml. If service is running in another process, it wouldn't be killed with activity.

How to send notification even if app is killed

java,android,android-background

It sounds like you want a notification to be posted to the notification bar. If so I advise using an alarm. However, chances are if this is days in the future, the phone may be shut off. So you should store when the alarm should go off, create a Broadcast...

Android Background service consuming lot of RAM. How to fix this?

android,android-intent,android-activity,android-background,android-wallpaper

Try clearing your wallpaper before setting a new one : private void doStuff(Intent myIntent){ ... for (int i = 0; i < File_Array.size(); i++) { Bitmap bitmap = BitmapFactory.decodeFile(File_Array.get(i)); try { myWallpaper.clear(); myWallpaper.setBitmap(bitmap); } catch (IOException e) { e.printStackTrace(); } or try using the Method myWallpaper.forgetLoadedWallpaper(); (Min API 14)...

RelativeLayout background drawable overlap content

android,android-layout,android-background

Exactly as I thought your content indicators are incorrect (unless you wanna introduce such a content padding with your 9-patch). Try this instead: Right and bottom guides, determine which part (or how much) of your drawable should be occupied by your content. You've set this region to really small space,...

How to stop multiple activities from launching on home button press

android,android-intent,android-activity,android-background

Use this code for that.. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) { // Activity was brought to front and not created, // Thus finishing this will get us to the last viewed activity finish(); return; } // Regular activity creation code... } This...

Android is killing my service?

android,service,broadcastreceiver,android-service,android-background

You may run the service in the foreground using startForeground(). A foreground service is a service that's considered to be something the user is actively aware of and thus not a candidate for the system to kill when low on memory. But bear in mind that a foreground service must...

Android json parsing in background without affecting activity performance

android,performance,android-intent,android-activity,android-background

Since there is no real question asked here, I Will give an answer that seems suiting to your problem. First you need to use Asyntasks, then after you treated the response you should do something like getting the instance of your database and calling the right Insertion method by passing...

Thread pool executor with background and ui thread vs Async task in android?

java,android,multithreading,android-asynctask,android-background

Just use AsyncTask. If you look into the source code of AsyncTask, you'll find AsyncTask just uses ThreadPoolExecutor and Handler....

Bind to service from new Context for configuration changes or bind from app context?

java,android,android-service,android-background,android-service-binding

So after doing some digging I think I have come up with an (as yet) untested solution. Firstly, based on Diane's suggestion here: https://groups.google.com/forum/#!topic/android-developers/Nb58dOQ8Xfw I should be binding to the application context - so my problem of losing the context is gone - I can maintain my ServiceConnection across configuration...

Android service periodically performing tasks in background?

java,android,android-activity,android-service,android-background

You need to add TimerTask, see how to do that here

Is there another way to create a backrground task without using AsyncTask?

android,android-background

For downloading data, you might use the DownloadManager service. More generally speaking, you could use IntentService as a fairly simple alternative to AsyncTask. One downside is it doesn't come with a built-in way to transport data to the Main Thread. You might use a Handler or the LocalBroadcastManager for this...

android - How to set listView item background like whatsapp

android,android-listview,listviewitem,android-background

Set ListView parent background with any drawable asset and listView background transparent then in listViewAdapter you have to item background transparent with 9patch image at wrapContent Width parameter of textView in listItem.

How long can a notification be kept for (permanently)?

android,android-lifecycle,android-notification-bar,android-background

The solution that seems to keep the service/notification running is to use a repeating alarm: public void startAlarm(){ alarmMgr = (AlarmManager)this.getSystemService(Context.ALARM_SERVICE); Intent intent = new Intent(this, NotificationService.class); alarmIntent = PendingIntent.getService(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); alarmMgr.setRepeating(AlarmManager.ELAPSED_REALTIME, SystemClock.elapsedRealtime(), 200*1000, alarmIntent); } I am not certain of the optimum frequency for resetting the alarm,...