Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Start an Activity from a Dialog Fragment

I have a Dialog Fragment attached to the Main Activity and is there any way we can start another Activity from the DialogFragment by a button Click.

My Intent call withing DialogFragment:

Intent i= new Intent(getActivity(),SecondActivity.class);

startActivity(i);

Have Registered the Second Activity in

Manifest.xml

as below

<activity android:name=".SecondActivity" 

          android:label="@string/app_name"  

          android:theme="@android:style/Theme.Dialog">

  <intent-filter>

        <action android:name="com.example.testjsoncall.SecondActivity" />
        <category android:name="android.intent.category.DEFAULT" />

  </intent-filter>

</activity>
like image 977
Anandaraja_Srinivasan Avatar asked Dec 16 '22 01:12

Anandaraja_Srinivasan


1 Answers

Hope this helps you :)

Intent i= new Intent(context,SecondActivity.class);

context.startActivity(i);
like image 157
Harshal Benake Avatar answered Dec 21 '22 23:12

Harshal Benake