0

hello dear friends, i need your help.
i'm not app developer but just trying to make a mock up. i created a android project with navigation drawer. and the navigation drawer is in string like. please help me friend i'm doing it for a national digital champion. if win i just wanna buy a pc cause my pc is death it is not able to execute an emulator

        <string name="title_section1">Section 1</string>
        <string name="title_section2">Section 2</string>
        <string name="title_section3">Section 3</string>

to section 28.
in a java file i have add

mDrawerListView.setAdapter(new ArrayAdapter<String>(
                getActionBar().getThemedContext(),
                android.R.layout.simple_list_item_activated_1,
                android.R.id.text1,
                new String[]{
                        getString(R.string.title_section1),
                        getString(R.string.title_section2),
                        getString(R.string.title_section3),
                        getString(R.string.title_section4),                       

to section28.
i main activity i have this code

  public void onNavigationDrawerItemSelected(int position) {
        // update the main content by replacing fragments
        FragmentManager fragmentManager = getFragmentManager();
        fragmentManager.beginTransaction()
                .replace(R.id.container, PlaceholderFragment.newInstance(position + 1))
                .commit();
    }

    public void onSectionAttached(int number) {
        switch (number) {
            case 1:
                mTitle = getString(R.string.title_section1);
                break;
            case 2:
                mTitle = getString(R.string.title_section2);
                break;
                //to section28

when i click on a menu item i get the number of item in the main.xml but what i want is to start new activity on click or layout because i'm just doing a mock up. i have to do it until 28 of this month please help me friends.

1
Contributor
2
Replies
19
Views
4 Years
Discussion Span
Last Post by chrisschristou
0

can i have help here please i know this code is what made the of menu item to appear on mainActivity.xml but how to convert it to onclick ??

public void onNavigationDrawerItemSelected(int position) {
        // update the main content by replacing fragments
        FragmentManager fragmentManager = getFragmentManager();
        fragmentManager.beginTransaction()
                .replace(R.id.container, PlaceholderFragment.newInstance(position + 1))
                .commit();
    }
0

please dear friends can someone help me please what i want realy is to cahnge fragment layout iif user click on an item of drawer menu
i tried to do it like on line 4 but i have an error <<Type mismatch: cannot convert from FragmentVue1 to CharSequence>>
and 3 option proposed by eclipse:

  1. Add cast 'CharSequence'
  2. Chnge type of 'mTitile'to 'FragmentVue'
  3. Let 'FragmentVue' implement 'CharSequence'

    public void onSectionAttached(int number) {
    switch (number) {
    case 1:
    mTitle = new FragmentVue1();
    break;
    case 2:
    mTitle = getString(R.string.title_section2);
    break;

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.