Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to open a activity? #9

Open
luyaohua2011 opened this issue May 27, 2013 · 6 comments
Open

how to open a activity? #9

luyaohua2011 opened this issue May 27, 2013 · 6 comments

Comments

@luyaohua2011
Copy link

Hello thank you for sharing. I want to click on the icon button to open an Activity, how to modify or rewrite the method?

@shkschneider
Copy link

Simply implements the callback setOnItemClickedListener() and implements your startActivity() there.

@shegogon
Copy link

can you show me how, thank you..

@shegogon
Copy link

untitled
@shkschneider
i have this method can you show me how to implement activity coz I want to click on the icon button to open an Activity

@cashlex
Copy link

cashlex commented Sep 6, 2016

am also interested in this question how can i make it click able to open a new activity

@xixiaozai
Copy link

you can try to use intent to open other activity

@cashlex
Copy link

cashlex commented Sep 7, 2016

i solved it by downloading a source code called protoshop and compared the programs and i resulted to this

public class SatelliteMenuActivity extends Activity {

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    SatelliteMenu menu = (SatelliteMenu) findViewById(R.id.menu);

// Set from XML, possible to programmatically set
// float distance = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 170, getResources().getDisplayMetrics());
// menu.setSatelliteDistance((int) distance);
// menu.setExpandDuration(500);
// menu.setCloseItemsOnClick(false);
// menu.setTotalSpacingDegree(60);

    List<SatelliteMenuItem> items = new ArrayList<SatelliteMenuItem>();
    items.add(new SatelliteMenuItem(4, R.drawable.ic_1));
    items.add(new SatelliteMenuItem(4, R.drawable.ic_3));
    items.add(new SatelliteMenuItem(4, R.drawable.ic_4));
    items.add(new SatelliteMenuItem(3, R.drawable.ic_5));
    items.add(new SatelliteMenuItem(2, R.drawable.ic_6));
    items.add(new SatelliteMenuItem(1, R.drawable.ic_2));

// items.add(new SatelliteMenuItem(5, R.drawable.sat_item));
menu.addItems(items);

    menu.setOnItemClickedListener(new SateliteClickedListener() {

        public void eventOccured(int id) {
            Log.i("sat", "Clicked on " + id);

            switch (id) {
            case 4:

                 Intent intent = new Intent(SatelliteMenuActivity.this, SecondActivity.class);
                 startActivity(intent);
                break;
            case 3:
                Intent intent1 = new Intent(SatelliteMenuActivity.this, SecondActivity.class);
                 startActivity(intent1);
                break;
            case 2:
                Intent intent11 = new Intent(SatelliteMenuActivity.this, SecondActivity.class);
                 startActivity(intent11);;
                break;
            case 1:
                Intent intent111 = new Intent(SatelliteMenuActivity.this, SecondActivity.class);
                 startActivity(intent111);
                break;
            default:
                break;
            }

        }
    });


}

}

which works thanks that what i was asking for

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants