How to change a TextView's text from a custom View?

Yes. We should first load the main layout before trying to get the sub-view. This is usually with following statement: setContentView(R.layout.

Your_layout) Please refer to developer.android.com/reference/android/... Also I suggest you firstly spend some time on the basic concept before trying to create complicated app. This will save you lots of time to finger out those questions.

Yes. We should first load the main layout before trying to get the sub-view. This is usually with following statement: setContentView(R.layout.

Your_layout); Please refer to developer.android.com/reference/android/... Also I suggest you firstly spend some time on the basic concept before trying to create complicated app. This will save you lots of time to finger out those questions.

Thx for your help, I am indeed a little confused about the structure of a good android app. I can't really figure where exactly I should put my code. From what I learned it seems that I need to put all my "logical" code in the activity, and not in the Views as I was trying to.

If you have any guide that explains how an android app is structured that would help me a lot! – TheAthena714 Jul 16 at 14:34.

AddsetContentView(R.layout. Your_filename_with_textview); before tv = (TextView) findViewById(R.id. Tv).

Thx for the reply, but unfortunately it doesn't work. If I put the setContentView, findViewById and tv. SetText in the activity it's working find, but I would like a way to call tv.

SetText from my Panel class, and I can't seem to call setContentView from within the Panel, so if I call findViewById it doesn't find anything... – TheAthena714 Jul 16 at 14:32.

I'm actually trying to build my first android app, and I just encountered a problem I can't figure out. As you can see in my constructor, I'm just trying to change the TextView's text from my Panel, and it won't work. If I don't put the "if (tv!

Crash at launch. I tried putting this piece of code in one of the listener's method instead of the constructor, and it's the same result : nothing happen or it crashes without the if condition. If I put the exact same code in the Activity's onCreate, it works perfectly, but my goal is to change the text/properties of the TextView based on the touch and gesture listener on my panel.

I'm really new to this android SDK, I have yet to try how to debug an app, but for now I would just like to know why this simple code isn't working. So if anyone has an idea as why I can't do that, or a work-around, I'd be much obliged!

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions