Bonjour à tous,
J'ai un petit problème sur un bouton partage.
Mon application est composé de quatre boutons en page d'accueil qui ouvre chacun sur un document liste.xml de ce type :
Lorsque l'on clique sur un item, on arrive sur une page xml de ce type :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <Button android:id="@+id/ast1Btn" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="..........." /> <Button android:id="@+id/ast2Btn" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text=".................." />
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center_horizontal" android:orientation="vertical" > <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" android:orientation="horizontal" android:paddingBottom="0dip" android:paddingTop="0dip" > <TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:text="................" android:textSize="100dp" /> </LinearLayout> <ScrollView android:id="@+id/ScrollView01" android:layout_width="fill_parent" android:layout_height="wrap_content" > <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=".........................." android:textColor="#002185" android:textSize="15dp" /> </ScrollView> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" android:orientation="horizontal" android:paddingBottom="5dip" android:paddingTop="5dip" > <ImageButton android:id="@+id/FacBtn" android:layout_width="32dp" android:layout_height="32dp" android:src="@drawable/facebook" /> </LinearLayout> </LinearLayout>
Mon activité est construite comme ça :
Je souhaite partager le contenu qu'il y a dans le id android suivant : @+id/textView2
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 public class AstActivity extends Activity implements OnClickListener { Button ast1Btn; Button ast2Btn; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.listeast); // ouvrir item1 ast1Btn = (Button) findViewById(R.id.ast1Btn); ast1Btn.setOnClickListener(this); // ouvrir item2 ast2Btn = (Button) findViewById(R.id.ast2Btn); ast2Btn.setOnClickListener(this); case R.id.FacBtn: Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("text/plain"); shareIntent.putExtra(Intent.EXTRA_TEXT, textView2.getContext().toString()); startActivity(Intent.createChooser(shareIntent, "Partager avec")); } }
Pour l'instant rien ne passe .... lorsque je teste sur mon téléphone... J'ai l'impression qu'il prend en compte uniquement la liste et pas la page lorsque l'on a choisi un item.
Partager