AIDE Tutorial - 37 Share Button on Facebook, Messenger and WhatsApp
Watch the video below
Main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:text="Share our article on Facebook,Messenger and on Whatsapp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:onClick="onfb"
android:text="Share on Facebook"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:onClick="onfb"
android:text="Share on Facebook"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:onClick="onmsg"
android:text="Share on Messenger"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:onClick="onmsg"
android:text="Share on Messenger"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:onClick="onapp"
android:text="Share on Whatsapp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:onClick="onapp"
android:text="Share on Whatsapp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
Main Activity.java
package com.kcgroup.sb;
package com.kcgroup.sb;
import android.app.*;
import android.os.*;
import android.view.*;
import android.content.*;
import android.widget.*;
import android.os.*;
import android.view.*;
import android.content.*;
import android.widget.*;
public class MainActivity extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
public void onfb(View v){try{
Intent intent=new Intent(
Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(intent.EXTRA_TEXT,"http://shyamkumarkc.blogspot.com/2017/09/live-nettv-watch-all-channels-for-free.html "+"Live NetTv App-Best App to watch online TV ");
intent.setPackage("com.facebook.katana");
startActivity(intent);
Toast.makeText(this,"Success",Toast.LENGTH_SHORT).show();
}catch(Exception e){
Toast.makeText(this,"Error!Facebook is not installed",Toast.LENGTH_SHORT).show();
}
}
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
public void onfb(View v){try{
Intent intent=new Intent(
Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(intent.EXTRA_TEXT,"http://shyamkumarkc.blogspot.com/2017/09/live-nettv-watch-all-channels-for-free.html "+"Live NetTv App-Best App to watch online TV ");
intent.setPackage("com.facebook.katana");
startActivity(intent);
Toast.makeText(this,"Success",Toast.LENGTH_SHORT).show();
}catch(Exception e){
Toast.makeText(this,"Error!Facebook is not installed",Toast.LENGTH_SHORT).show();
public void onmsg(View v){try{
Intent intent=new Intent(
Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(intent.EXTRA_TEXT,"http://shyamkumarkc.blogspot.com/2017/09/live-nettv-watch-all-channels-for-free.html "+"Live NetTv App-Best App to watch online TV ");
intent.setPackage("com.facebook.orca");
startActivity(intent);
Toast.makeText(this,"Success",Toast.LENGTH_SHORT).show();
}catch(Exception e){
Toast.makeText(this,"Error!Messenger is not installed",Toast.LENGTH_SHORT).show();
}
}
Intent intent=new Intent(
Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(intent.EXTRA_TEXT,"http://shyamkumarkc.blogspot.com/2017/09/live-nettv-watch-all-channels-for-free.html "+"Live NetTv App-Best App to watch online TV ");
intent.setPackage("com.facebook.orca");
startActivity(intent);
Toast.makeText(this,"Success",Toast.LENGTH_SHORT).show();
}catch(Exception e){
Toast.makeText(this,"Error!Messenger is not installed",Toast.LENGTH_SHORT).show();
public void onapp(View v){try{
Intent intent=new Intent(
Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(intent.EXTRA_TEXT,"http://shyamkumarkc.blogspot.com/2017/09/live-nettv-watch-all-channels-for-free.html "+"Live NetTv App-Best App to watch online TV ");
intent.setPackage("com.whatsapp");
startActivity(intent);
Toast.makeText(this,"Success",Toast.LENGTH_SHORT).show();
}catch(Exception e){
Toast.makeText(this,"Error!Whatsapp is not installed",Toast.LENGTH_SHORT).show();
}} }
Intent intent=new Intent(
Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(intent.EXTRA_TEXT,"http://shyamkumarkc.blogspot.com/2017/09/live-nettv-watch-all-channels-for-free.html "+"Live NetTv App-Best App to watch online TV ");
intent.setPackage("com.whatsapp");
startActivity(intent);
Toast.makeText(this,"Success",Toast.LENGTH_SHORT).show();
}catch(Exception e){
Toast.makeText(this,"Error!Whatsapp is not installed",Toast.LENGTH_SHORT).show();
}} }
M.a
ReplyDeleteMa
ReplyDelete