• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

getResources from non-activity (regular) class

 
Ranch Hand
Posts: 202
Android PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Today, i faced new weird problem.

i am making an application which has 10 Activity in it, and i want to set background image to all.
So the problem is, i do not want to write same code 10 times for each activity.

Instead doing that i create a regular class and add background creation codes in it
there the problems start.

If i write code inside of each activity then works perfect but not from other class.

I have tried many different ways but no luck, seems my background class does not get setting class resource.

How can i solve this?

Regards


Settings class


and DrawBackground class
 
ibrahim yener
Ranch Hand
Posts: 202
Android PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have just checked context object by log.i and this is the result.

context settings (this) android.app.Application@2afce658
context settings (non) android.app.Application@2afce658
context bgclass android.app.Application@2afce658

seems background class getting correct object but don't know why
background is not tiling.
 
ibrahim yener
Ranch Hand
Posts: 202
Android PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I solved problem.
Please do not ask me how because i feel stupid.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic