Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getResources from non-activity (regular) class

 
ibrahim yener
Ranch Hand
Posts: 202
Android Java PHP
  • Mark post as helpful
  • send pies
  • 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 Java PHP
  • Mark post as helpful
  • send pies
  • 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 Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I solved problem.
Please do not ask me how because i feel stupid.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic