Skip to content

Commit 259c14c

Browse files
author
gcohen
committed
adding clickable UI for demo app
1 parent af3f10d commit 259c14c

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

‎android/examples/PubnubExample/res/layout/usage.xml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
</LinearLayout>
2727

2828
<LinearLayout
29+
android:clickable="true"
30+
android:id="@+id/clicklayout"
2931
android:layout_width="match_parent"
3032
android:layout_height="wrap_content"
3133
android:layout_marginLeft="@dimen/optionmarginleft"

‎android/examples/PubnubExample/src/com/pubnub/examples/pubnubExample/MainActivity.java‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import java.util.Hashtable;
44

5+
import android.view.View;
6+
import android.widget.LinearLayout;
57
import org.json.JSONArray;
68
import org.json.JSONObject;
79

@@ -20,6 +22,7 @@
2022
import android.view.MenuItem;
2123
import android.widget.EditText;
2224
import android.widget.Toast;
25+
import android.view.View.OnClickListener;
2326

2427
import com.pubnub.api.Callback;
2528
import com.pubnub.api.Pubnub;
@@ -89,6 +92,13 @@ public void onReceive(Context arg0, Intent intent) {
8992

9093
}, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
9194

95+
LinearLayout clicklayout = (LinearLayout) findViewById(R.id.clicklayout);
96+
clicklayout.setOnClickListener(new LinearLayout.OnClickListener() {
97+
public void onClick(View v) {
98+
openOptionsMenu();
99+
}
100+
});
101+
92102
}
93103

94104
@Override

0 commit comments

Comments
 (0)