Win a copy of Java Persistence with Spring Data and Hibernate this week in the Spring forum!
  • 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
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

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.
 
What a stench! Central nervous system shutting down. Save yourself tiny ad!
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic