Sungguk Lim
Sungguk Lim

Reputation: 6228

Toast message only in Testing

I am android newbie.

I made a simple program, and I used Toast code for checking if variable is correct or not. After finishing test, I have to remove all the Toast code to release app. I think there must be more effective and better way to do this.

please help me

thank you in advance.

Upvotes: 1

Views: 492

Answers (5)

Lawrence D'Oliveiro
Lawrence D'Oliveiro

Reputation: 2804

I’ve never bothered with the Log class, because I found that everything written to System.err appears in the Android log regardless.

Upvotes: -1

Nappy
Nappy

Reputation: 3046

I would extend the Log class and redirect everything to android.Log. In your own implementation you can then fire the Toast.

You will need to pass the Context and maybe execute it on UI thread.

Upvotes: 1

andreas
andreas

Reputation: 1595

If you use Log.[vdiwe], you should consider to use Androlog. It does the same as the default android Log class, but you can switch it of when you release your app later on.

It also supports some kind of reporting mechanism, which I did not test up to now, but looks promising.

Upvotes: 0

CommonMan
CommonMan

Reputation: 3928

If you use ant, you can have define some parameter like build.debug in build.properties files, you will need to have two different files build_dbg.properties and build_rel.properties.

Upvotes: 1

evilone
evilone

Reputation: 22740

Use LogCat. You can output values to LogCat output using Log.d in your code. You can read detailed information about LogCat and logging here Debugging in Android using Eclipse

Upvotes: 2

Related Questions