PlusMinus - I need you plox!!!!

Basic Tutorials concerning: GUI, Views, Activites, XML, Layouts, Intents, ...

PlusMinus - I need you plox!!!!

Postby limteckchai » Wed Jun 30, 2010 9:36 am

Hi all,
Hopefully one of you can minus and divide my problem by enlightening me.

I have an java file with a button inside, what it does is ( setContentView(R.layout.main2); )
in main2, i also have another button.
And i want that button to link it back to the first page.
Code: Select all

button2.setOnClickListener(new View.OnClickListener() {
public void onClick(View view){
setContentView(R.layout.main)}



But apparently i keep getting null pointer exception error in logcat.

The question is, if i have a java file, and i need to change layout, where do i code the 2nd button ?
( there is 1 button in main , and 1 button in main2)
Pls revert asap. Million Thanks !!
limteckchai
Experienced Developer
Experienced Developer
 
Posts: 92
Joined: Mon Jun 28, 2010 3:33 am

Top

Re: PlusMinus - I need you plox!!!!

Postby vengeance_mj » Thu Jul 01, 2010 2:19 am

You may try to use Intents to switch between activities or try using a ViewFlipper
vengeance_mj
Senior Developer
Senior Developer
 
Posts: 174
Joined: Thu Oct 29, 2009 2:32 am

Re: PlusMinus - I need you plox!!!!

Postby blundell » Thu Jul 01, 2010 2:15 pm

Is your NPE on button2?

Did you use findViewById(R.id.button2); ?

vengeance is right would probably be better to switch activities but this is dependant on what you want to achieve
User avatar
blundell
Master Developer
Master Developer
 
Posts: 1610
Joined: Tue Nov 18, 2008 12:58 pm
Location: UK

Re: PlusMinus - I need you plox!!!!

Postby limteckchai » Tue Jul 20, 2010 8:03 am

Thanks i sorta got it fixed with some help from ppl!!!
limteckchai
Experienced Developer
Experienced Developer
 
Posts: 92
Joined: Mon Jun 28, 2010 3:33 am

Re: PlusMinus - I need you plox!!!!

Postby limteckchai » Wed Jul 21, 2010 4:53 am

Anyone knows where i can go to read about proxy, cause i m currently doing a location base service which requires the pulling of data from a server. The emulator is able to pull out the results, but apparently on the phone , due to security issues there are some issues with the results.
Please Advice,







Anyone here plays FrontierVille???? message me for invite
Lvl 12
limteckchai
Experienced Developer
Experienced Developer
 
Posts: 92
Joined: Mon Jun 28, 2010 3:33 am

Top

Return to Novice Tutorials

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 7 guests