Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

how to open an activity from a fragment

Button btn1 = (Button) thisLayout
            .findViewById(R.id.btnDb1);

    btn1.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            Intent intent = new Intent(getActivity(), otherActivity.class);
            ((MainActivity) getActivity()).startActivity(intent);

        }
    });

    return thisLayout;
}
Comment

PREVIOUS NEXT
Code Example
Java :: java create file if not exists 
Java :: caesar cipher java 
Java :: play sound in java 
Java :: sorting char array in java 
Java :: android push notification icon 
Java :: java expressions 
Java :: float vs double java 
Java :: java leap year expression 
Java :: android splash screen 
Java :: Error: Could not find or load main class -Djava.library.path=.home.hdoop.hadoop-3.3.0.lib.native 
Java :: Error inflating class ImageView 
Java :: what it means when create final variable in java 
Java :: sorting the characters in a String in java 
Java :: java selenium send keys integer 
Java :: bufferedinputstream to byte array 
Java :: jbutton set on action 
Java :: java file system append new line 
Java :: get last index of array java 
Java :: java hashmap key exists 
Java :: get text from a jtextfield 
Java :: select in selenium java 
Java :: check if number is odd java 
Java :: how to get key value from json object in java 
Java :: default method in java 
Java :: android get list element by index 
Java :: java thread dump 
Java :: json to hashmap java stream 
Java :: android switch on change 
Java :: max int in java 
Java :: split number java 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =