开发者

why doesn't my 4th intent button work?

开发者 https://www.devze.com 2023-03-13 23:47 出处:网络
m i missing something? the first 3 work fine. public void onClick(View v) { switch (v.getId()) { case R.id.hawknation_button:

m i missing something? the first 3 work fine.

public void onClick(View v) {

switch (v.getId()) {
case R.id.hawknation_button:
   Intent i = new Intent(this, HawkNationRSS.class);
   startActivity(i);
   break;
   case R.id.hawkcentral_button:
   Intent i1 = new Intent(this, HawkCentralRSS.class);
  开发者_运维问答 startActivity(i1);
   break; 
   case R.id.hawkeyesports_button:
       Intent i2 = new Intent(this, HawkeyeSportsRSS.class);
       startActivity(i2);
       break;    
   case R.id.espn_button:
       Intent i3 = new Intent(this, HawkeyeSportsRSS.class);
       startActivity(i3);
       break;


 }


Try finishing previous activity(ies) in each case. Maybe they are invoking(or returning to) onResume() since you are calling same class and they are separate activities.


Seeing as the third and fourth cases are in essence identical and you're saying the other three work, make sure that R.id.espn_button is indeed the correct resource ID, and that you've set the onClick handler for that button as well.


Sorry, I should have done more digging before posting this. Forgot one critical line.

espn.setOnClickListener(this);
0

精彩评论

暂无评论...
验证码 换一张
取 消