title: Using other app to send message to line app
body: <p>I try the following code to send messages to line app. It works; however, before I send message,it will move to the line friends page and I have to choose friends whom I want to send the messages to. How could I modify the code that I could choose friends  at code instead of choosing friends manually.</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  
  static final int REQUEST_ACTION_PICK = 1;
  public static final String PACKAGE_NAME = "jp.naver.line.android";
  public static final String CLASS_NAME = "jp.naver.line.android.activity.selectchat.SelectChatActivity";
  private List&lt;ApplicationInfo&gt; m_appList;
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      sendTextHandler(this);
  }
  
  
  public void sendTextHandler(MainActivity view) {
      String sendText = ((TextView)findViewById(R.id.send_text)).getText().toString();
      if(checkLineInstalled()){
          Intent intent = new Intent(Intent.ACTION_SEND);
          intent.setClassName(PACKAGE_NAME, CLASS_NAME);
          intent.setType("text/plain");
          intent.putExtra(Intent.EXTRA_TEXT, sendText);
          startActivity(intent);
      }else{
          Toast toast = Toast.makeText(this, "LINEがインストールされていません", Toast.LENGTH_SHORT);
          toast.show();
      }
  }
  private boolean checkLineInstalled(){
      PackageManager pm = getPackageManager();
      m_appList = pm.getInstalledApplications(0);
      boolean lineInstallFlag = false;
      for (ApplicationInfo ai : m_appList) {
          if(ai.packageName.equals(PACKAGE_NAME)){
              lineInstallFlag = true;
              break;
          }
      }
      return lineInstallFlag;
  }
  
  }
  </code></pre>
  
  <p>The code is from <a href="https://gist.github.com/ekos/3993270" rel="nofollow">https://gist.github.com/ekos/3993270</a>.</p>