CopyPastor

Detecting plagiarism made easy.

Score: 2; Reported for: String similarity, Exact paragraph match Open both answers

Possible Plagiarism

Plagiarized on 2020-08-31
by Taha Gorme

Original Post

Original - Posted on 2013-12-23
by VJ Vélan Solutions



            
Present in both answers; Present only in the new answer; Present only in the old answer;

Do not handle the `onClick` for the fragment button in the Fragment. Let it go it's parent activity. And start the activity from the parent activity.
To make sure that the button `onClick` event is sent to the parent activity, make sure, in your `about.xml`, for the button with `id btnContactDev`, you have the following parameter:
<Button android:id="@+id/btnContactDev" android:onClick="buttonClick" ... />
and in your parent activity (parent of `About` fragment), you have:
public void buttonClick(View v) { switch(v.getId()) { case R.id.btnContactDev: Intent myIntent = new Intent(); myIntent.setClassName(your_package_name_string, your_activity_name_string); // for ex: your package name can be "com.example" // your activity name will be "com.example.Contact_Developer" startActivity(myIntent); break; } }
HTH.
PS: This solution is very specific for what your requirement. In general, it's best to handle the `onClick` events related to the fragment inside the fragment class.
PS: Yes, as the other solution says, make sure you have registered the `Contact_Developer` Activity in your `Manifest` file.
Do not handle the `onClick` for the fragment button in the Fragment. Let it go it's parent activity. And start the activity from the parent activity.
To make sure that the button `onClick` event is sent to the parent activity, make sure, in your `about.xml`, for the button with `id btnContactDev`, you have the following parameter:
<Button android:id="@+id/btnContactDev" android:onClick="buttonClick" ... />
and in your parent activity (parent of `About` fragment), you have:
public void buttonClick(View v) { switch(v.getId()) { case R.id.btnContactDev: Intent myIntent = new Intent(); myIntent.setClassName(your_package_name_string, your_activity_name_string); // for ex: your package name can be "com.example" // your activity name will be "com.example.Contact_Developer" startActivity(myIntent); break; } }
HTH.
PS: This solution is very specific for what your requirement. In general, it's best to handle the `onClick` events related to the fragment inside the fragment class.
PS: Yes, as the other solution says, make sure you have registered the `Contact_Developer` Activity in your `Manifest` file.

        
Present in both answers; Present only in the new answer; Present only in the old answer;