Created
November 19, 2013 18:01
-
-
Save keiji/7549604 to your computer and use it in GitHub Desktop.
For reproduction to the issue https://code.google.com/p/android/issues/detail?id=61937.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:paddingBottom="@dimen/activity_vertical_margin" | |
android:paddingLeft="@dimen/activity_horizontal_margin" | |
android:paddingRight="@dimen/activity_horizontal_margin" | |
android:paddingTop="@dimen/activity_vertical_margin" | |
tools:context=".MainActivity" > | |
<TextView | |
android:id="@+id/textView1" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:text="@string/hello_world" /> | |
<Button | |
android:id="@+id/button_chooser" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_alignLeft="@+id/textView1" | |
android:layout_below="@+id/textView1" | |
android:layout_marginLeft="38dp" | |
android:layout_marginTop="46dp" | |
android:text="Chooser" /> | |
<Button | |
android:id="@+id/button_send" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_alignBaseline="@+id/button_chooser" | |
android:layout_alignBottom="@+id/button_chooser" | |
android:layout_marginLeft="30dp" | |
android:layout_toRightOf="@+id/button_chooser" | |
android:text="SEND" /> | |
</RelativeLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.sample; | |
import android.app.Activity; | |
import android.content.Intent; | |
import android.os.Bundle; | |
import android.view.Menu; | |
import android.view.View; | |
import android.view.View.OnClickListener; | |
public class MainActivity extends Activity implements OnClickListener { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
findViewById(R.id.button_send).setOnClickListener(this); | |
findViewById(R.id.button_chooser).setOnClickListener(this); | |
} | |
@Override | |
public void onClick(View arg0) { | |
Intent send = new Intent(Intent.ACTION_SEND); | |
send.setType("text/plain"); | |
send.putExtra(Intent.EXTRA_TEXT, "I'm test"); | |
switch(arg0.getId()) { | |
case R.id.button_chooser: | |
startActivity(Intent.createChooser(send, "Select app to share")); | |
break; | |
case R.id.button_send: | |
startActivity(send); | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment