I put in a stopwatch png, and I am trying to design it right now but when I place the chronometer I cant see it overtop the image. Color isn't the issue so it isn't blending in. I tried making the background of the chronometer the same as the image but still nothing. I see it once I move it away from image, but not where I want it.
<Chronometer
android:id="#+id/chronometer"
android:format="%s"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="40sp"
android:textColor="#ffffff"
android:background="#drawable/stopwatch2"
android:layout_alignTop="#+id/my_button"
android:layout_alignLeft="#+id/my_button"
android:layout_alignStart="#+id/my_button" />
<Button
android:id="#+id/my_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/stopwatch2"
android:text=" "
android:layout_marginTop="71dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
MAIN ACTIVITY
public class MainActivity extends AppCompatActivity {
Chronometer mChronometer;
private int loop = 0;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
setClick();
}
public void setClick() {
Button button;
mChronometer = (Chronometer) findViewById(R.id.aChronometer);
// Watch for button clicks.
button = (Button) findViewById(R.id.stopWatch);
button.setOnClickListener(mStartListener);
button = (Button) findViewById(R.id.stopWatch);
button.setOnClickListener(mStartListener);
button = (Button) findViewById(R.id.stopWatch);
button.setOnClickListener(mStartListener);
}
View.OnClickListener mStartListener = new OnClickListener() {
public void onClick(View v) {
if (loop == 0) {
mChronometer.setBase(SystemClock.elapsedRealtime());
mChronometer.start();
loop++;
} else if (loop == 1) {
mChronometer.stop();
loop++;
} else if (loop == 2) {
mChronometer.setBase(SystemClock.elapsedRealtime());
loop = 0;
}
}
};
Related
I am new to android development. The problem is the RecyclerView populated using a firebase database is not replaced by a new fragment, rather the new fragment is on top, but clicking on another item of the recycler view still works, which I checked using a toast in the new fragment. I know that the next fragment is there because I have TextView at the bottom, which is visible on clicking on the recycler view Item.
Here is my code
adapter = new FirebaseRecyclerAdapter<Categories, CategoryViewHolder>(options) {
#Override
protected void onBindViewHolder(#NonNull final CategoryViewHolder holder, int position, #NonNull Categories model)
{
Picasso.get().load(model.getImage()).placeholder(R.drawable.camera).into(holder.categoryImage, new Callback() {
#Override
public void onSuccess()
{
}
#Override
public void onError(Exception e) {
Toast.makeText(getContext(), e.getMessage(), Toast.LENGTH_SHORT).show();
}
});
holder.categoryName.setText(model.getName());
holder.categoryImage.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Toast.makeText(getContext(), holder.categoryName.getText().toString(), Toast.LENGTH_SHORT).show();
// Intent intent = new Intent(getActivity(), ProductListActivity.class);
// startActivity(intent);
AppCompatActivity activity = (AppCompatActivity) view.getContext();
SearchFragment fragment = SearchFragment.newInstance(holder.categoryName.getText().toString());
FragmentManager fragmentManager = activity.getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.nav_host_fragment, fragment, SearchFragment.class.getSimpleName());
fragmentTransaction.addToBackStack(null);
fragmentTransaction.commit();
}
});
The fragment I am using is also used for the navigation drawer using navController.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:showIn="#layout/app_bar_main">
<fragment
android:id="#+id/nav_host_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:defaultNavHost="true"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:navGraph="#navigation/mobile_navigation" />
</RelativeLayout>
Edit: I have another recyclerView inside SearchFragment, which didn't show after I clicked an image in the RecyclerView(One which calls SearchFragment). But it showed after I minimized and opened the app again. I don't understand why that is happening.
I just found an easy way to move from one fragment to another without using FragmentManager. I hope this helps others, it worked for me. Initialize the NavController in the first fragment inside onCreateView
navController = Navigation.findNavController(getActivity(), R.id.nav_host_fragment);
And adding the following for transition
Bundle bundle = new Bundle();
bundle.putString("Category", holder.categoryName.getText().toString());
navController.navigate(R.id.nav_category_product_list, bundle);
to get the argument in the moving fragment type this
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true); //To get menu items at the top
if (getArguments() != null) {
Category = getArguments().getString("Category");
}
}
Also, add this transition in Navigation graph XML
.
.
.
<fragment
android:id="#+id/nav_category"
android:name="com.grocery.admin.ui.category.CategoryFragment"
android:label="#string/menu_category"
tools:layout="#layout/fragment_category" >
<action
android:id="#+id/action_nav_category_to_nav_category_product_list"
app:destination="#id/nav_category_product_list" />
</fragment>
<fragment
android:id="#+id/nav_category_product_list"
android:name="com.grocery.admin.ui.category.CategoryProductFragment"
android:label="Product List"
tools:layout="#layout/fragment_category_product">
</fragment>
.
.
.
I have 6 Fragments each with a RadioGroup containing 4 radio buttons they are all displayed on the same activity using a viewpager so the user can swipe through them.
i have been trying to implement an onCheckedChangedListener on each RadioGroup so I can know which radio button was checked in each fragment.
I've tried many things over the past days and my working solution is extremely long winded and there is surely a better way.
This is my activity that calls the fragments with the current solution in it
public class QuestionsActivity extends AppCompatActivity {
Toolbar toolbar;
ViewPager mViewPager;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_questions);
// tool bar
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
mViewPager = (ViewPager) findViewById(R.id.pager);
/** set the adapter for ViewPager */
mViewPager.setAdapter(new MyPagerAdapter(
getSupportFragmentManager()));
}
/**
* Defining a FragmentPagerAdapter class for controlling the fragments to be shown when user swipes on the screen.
*/
public class MyPagerAdapter extends FragmentPagerAdapter {
public MyPagerAdapter(FragmentManager fm) {
super(fm);
}
#Override
public Fragment getItem(int position) {
/** Show a Fragment based on the position of the current screen */
if (position == 0) {
return new Q1Fragment();
} else if (position == 1) {
return new Q2Fragment();
} else if (position == 2) {
return new Q3Fragment();
} else if (position == 3) {
return new Q4Fragment();
} else if (position == 4) {
return new Q5Fragment();
} else
return new Q6Fragment();
}
#Override
public int getCount() {
// Show 2 total pages.
return 6;
}
}
public void onRadio1Clicked(View view) {
boolean checked = ((RadioButton) view).isChecked();
switch (view.getId()) {
case R.id.radioButton1:
if (checked) {
Context context = getApplicationContext();
int duration = Toast.LENGTH_SHORT;
CharSequence text = "radio1";
Toast toast = Toast.makeText(context, text, duration);
toast.show();
}
break;
case R.id.radioButton2:
if (checked) {
Context context = getApplicationContext();
int duration = Toast.LENGTH_SHORT;
CharSequence text = "radio2";
Toast toast = Toast.makeText(context, text, duration);
toast.show();
}
break;
case R.id.radioButton3:
if (checked) {
Context context = getApplicationContext();
int duration = Toast.LENGTH_SHORT;
CharSequence text = "radio3";
Toast toast = Toast.makeText(context, text, duration);
toast.show();
}
break;
case R.id.radioButton4:
if (checked) {
Context context = getApplicationContext();
int duration = Toast.LENGTH_SHORT;
CharSequence text = "radio4";
Toast toast = Toast.makeText(context, text, duration);
toast.show();
}
break;
}
}
public void onRadio2Clicked(View view) {
boolean checked = ((RadioButton) view).isChecked();
switch (view.getId()) {
case R.id.radioButton1:
if (checked) {
Context context = getApplicationContext();
int duration = Toast.LENGTH_SHORT;
CharSequence text = "radio1";
Toast toast = Toast.makeText(context, text, duration);
toast.show();
}
break;
case R.id.radioButton2:
if (checked) {
Context context = getApplicationContext();
int duration = Toast.LENGTH_SHORT;
CharSequence text = "radio2";
Toast toast = Toast.makeText(context, text, duration);
toast.show();
}
break;
case R.id.radioButton3:
if (checked) {
Context context = getApplicationContext();
int duration = Toast.LENGTH_SHORT;
CharSequence text = "radio3";
Toast toast = Toast.makeText(context, text, duration);
toast.show();
}
break;
case R.id.radioButton4:
if (checked) {
Context context = getApplicationContext();
int duration = Toast.LENGTH_SHORT;
CharSequence text = "radio4";
Toast toast = Toast.makeText(context, text, duration);
toast.show();
}
break;
}
}
}
For each radio group i use android:onClick function in xml and create a new method for each one. above is just 2 of them.
Here is what a fragment looks like
<RadioGroup
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/radioGroup1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
>
<RadioButton
android:id="#+id/radioButton1"
android:layout_width="310dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#drawable/border"
android:layout_marginTop="18dp"
android:padding="10dp"
android:text="#string/radio"
android:onClick="onRadio1Clicked"
/>
<RadioButton
android:id="#+id/radioButton2"
android:layout_width="310dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#drawable/border"
android:layout_marginTop="18dp"
android:padding="10dp"
android:text="#string/radio1"
android:onClick="onRadio1Clicked"/>
<RadioButton
android:id="#+id/radioButton3"
android:layout_width="310dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#drawable/border"
android:layout_marginTop="18dp"
android:padding="10dp"
android:text="#string/radio2"
android:onClick="onRadio1Clicked"/>
<RadioButton
android:id="#+id/radioButton4"
android:layout_width="310dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#drawable/border"
android:layout_marginTop="18dp"
android:padding="10dp"
android:text="#string/radio3"
android:onClick="onRadio1Clicked"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="#string/submit"
android:layout_marginTop="13dp"
/>
</RadioGroup>
I have tried using a listener like in both the main activity and the fragment activity and i get null pointer exceptions for the second radiogroup.
Here is what a variation of the listener looks like, this is one i tried to use in a fragment activity
RadioGroup rg1 = (RadioGroup) getView().findViewById(R.id.radioGroup1);
rg1.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener()
{
#Override
public void onCheckedChanged (RadioGroup group,int checkedId){
Context context = getContext();
RadioButton thisButton = (RadioButton) getView().findViewById(checkedId);
Toast toast = Toast.makeText(context, thisButton.getText(), Toast.LENGTH_SHORT);
toast.show();
}
}
);
Whatever I do I cannot get the listener to work on fragment other than the first.
Any Ideas?
Just remove all android:onClick="onRadio1Clicked" from your layouts and setOnCheckedChangeListener code from your activity and implement it in fragments like in Q1Fragment override onViewCreated method and write code there, so on in other fragments.
in Q1Fragment :-
#Override
public void onViewCreated(View view, #Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
RadioGroup rg1 = (RadioGroup) view.findViewById(R.id.radioGroup1);
rg1.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener()
{
#Override
public void onCheckedChanged (RadioGroup group,int checkedId){
Context context = getContext();
RadioButton thisButton = (RadioButton) getView().findViewById(checkedId);
Toast toast = Toast.makeText(context, thisButton.getText(), Toast.LENGTH_SHORT);
toast.show();
}
}
);
}
in Q2Fragment :-
#Override
public void onViewCreated(View view, #Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
RadioGroup rg2 = (RadioGroup) view.findViewById(R.id.radioButton2);
rg2.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener()
{
#Override
public void onCheckedChanged (RadioGroup group,int checkedId){
Context context = getContext();
RadioButton thisButton = (RadioButton) getView().findViewById(checkedId);
Toast toast = Toast.makeText(context, thisButton.getText(), Toast.LENGTH_SHORT);
toast.show();
}
}
);
}
I tried to display a small imageview above the big imageview .It worked fine.
But when I made the small imageview to appear in rounded shape, It is not showing up.. Your reply will be helpful
there is no error or warning or any crashing of avd .simply the small imageview is not showing
.xml file:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:adjustViewBounds="true"
android:maxHeight="1000dp"
android:maxWidth="1000dp"
android:scaleType="fitXY"
android:src="#drawable/ciaz"
tools:ignore="ContentDescription" />
<ImageView
android:id="#+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/imageView1"
android:layout_centerHorizontal="true"
android:layout_marginBottom="14dp"
android:adjustViewBounds="true"
android:maxHeight="300dp"
android:maxWidth="300dp"
android:scaleType="fitXY"
android:src="#drawable/ac"
android:visibility="visible"
tools:ignore="ContentDescription,RtlHardcoded" />
</RelativeLayout>
mainactivity.java
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
im1 = (ImageView) findViewById(R.id.imageView1);
im2 = (ImageView) findViewById(R.id.imageView2);
im1.setOnTouchListener(new OnTouchListener() {
#Override
public boolean onTouch(View arg0, MotionEvent arg1) {
try
{
int action=arg1.getAction();
float x=(float)arg1.getX();
float y=(float)arg1.getY();
if(action==MotionEvent.ACTION_DOWN)
{
context = getApplicationContext();
duration = Toast.LENGTH_SHORT;
String g= x+" "+y;
Toast toast = Toast.makeText(context, g, duration);
toast.show();
if((x>0.0) && (x<100)&&(y>0.0) && (y<100))
{
im2.setVisibility(View.VISIBLE);
Bitmap bm = BitmapFactory.decodeResource(getResources(),R.drawable.ac);
roundedImage = new RoundedImageView(bm);
im2.setImageDrawable(roundedImage);
}
}
}
catch(Exception e)
{
Toast toast = Toast.makeText(context, "exception", duration);
toast.show();
}
return false;
}
});
}
enter code here
Make sure that if you are using relative layout, place big image view first and then after small age view. Otherwise big image view overlaps small image view. If that is not the case can u please give code snippet to help more and find out the issue ?
You are giving 1000 h and 1000 w for first image view, and using android:layout_alignBottom="#+id/imageView1" in second imageview. So it goes out of ur device screen. Use match parent for first image view and remove alignbottom.
I'm currently trying to program an Android Launcher with Fragments but I have problems with the Views on the Fragments.
I have a Dock-Fragment with a Dock-Controller which allow the user to change fragments, such as apps menu, settings fragment etc. The Dock is displayed on the buttom of the display, the Fragments(apps menu, settings fragment) should be displayed above the Dock.
The problem is, that the apps menu is not shown in its associated Fragment but rather in the Dock Fragment behind the dock icons,... So I guess, the app menu fragment gets the wrong view in its onCreateView()-Method, but I don't get why.
This is the code of the MainActivity that extends from FragmentActivity. I add the fragments to the manager.
private void addDockToManager() {
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
ft.add(dbConnection.getLayout(DOCK_TAG), dockController.getFragment(), DOCK_TAG);
ft.commit();
}
private void addPluginsToManager() {
FragmentManager fm = null;
FragmentTransaction ft = null;
for(String key : controllerMap.keySet()) {
fm = getSupportFragmentManager();
ft = fm.beginTransaction();
FrameController controller = null;
if ((controller = controllerMap.get(key)) != null) {
ft.add(dbConnection.getLayout(key), controller.getFragment(), key);
if (key.equals(standardFrame))
ft.addToBackStack(key);
}
ft.commit();
fm.executePendingTransactions();
}
fm = getSupportFragmentManager();
ft = fm.beginTransaction();
for(String key : controllerMap.keySet()) {
if (controllerMap.get(key) != null && !key.equals(standardFrame)) {
ft.hide(fm.findFragmentByTag(key));
}
}
ft.commit();
}
The layouts are hardcoded at the moment in dbConnection:
public int getLayout(String name) {
int layout = -1;
switch(name) {
case "app_menu" : layout = R.id.fl_app_menu;
case "settings" : layout = R.id.fl_settings;
case "dock" : layout = R.id.fl_dock;
}
return layout;
}
The MainActivity's xml looks like that:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/rl_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.activity.MainActivity"
tools:ignore="MergeRootFrame" >
<FrameLayout
android:id="#+id/fl_settings"
android:layout_width="match_parent"
android:layout_height="400dp"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_above="#+id/fl_dock"
android:background="#00ffffff" >
</FrameLayout>
<FrameLayout
android:id="#+id/fl_app_menu"
android:layout_width="match_parent"
android:layout_height="400dp"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_above="#+id/fl_dock"
android:background="#00ffffff" >
</FrameLayout>
<FrameLayout
android:id="#+id/fl_dock"
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" >
</FrameLayout>
</RelativeLayout>
The xml of the apps menu is a gridview and looks like that:
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/gv_apps"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:numColumns="6"
android:gravity="center"
android:columnWidth="50dp"
android:stretchMode="columnWidth" >
</GridView>
The App Fragment looks like that:
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup group,
Bundle savedInstanceState) {
view = inflater.inflate(R.layout.external_apps, group, false);
layout = (GridView) view.findViewById(R.id.gv_apps);
return view;
}
#Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
GridViewAdapter gridViewAdapter = new GridViewAdapter((AppMenuController) myController, apps);
((GridView) layout).setAdapter(gridViewAdapter);
}
And the getView Method of the GridViewAdapter:
#Override
public View getView(int position, View convertView, ViewGroup parent) {
ImageView imageView = new ImageView(controller.getMainActivity().getApplicationContext());
imageView.setImageDrawable(buttons.get(position).getIcon());
imageView.setLayoutParams(new GridView.LayoutParams(65, 65));
return imageView;
}
I hope what I mentioned is enough to resolve the problem. I am searching the web for hours but I found no solution.
It's a much simpler problem than that I think.
public int getLayout(String name) {
int layout = -1;
switch(name) {
case "app_menu" : layout = R.id.fl_app_menu;
case "settings" : layout = R.id.fl_settings;
case "dock" : layout = R.id.fl_dock;
}
return layout;
}
Should be:
public int getLayout(String name) {
int layout = -1;
switch(name) {
case "app_menu" :
layout = R.id.fl_app_menu;
break;
case "settings" :
layout = R.id.fl_settings;
break;
case "dock" :
layout = R.id.fl_dock;
break;
}
return layout;
}
Because switch-case structure is still essentially just an organized goto, and not actually an if-else structure, aka if you don't break out, then all cases will run sequentially.
I found the problem. And it was in a part of the code I never expected it to be.
The Dummy-Switch-Case in dbConnection caused it. Seemingly Strings aren't compared by value but rather by reference in such a Switch-Case. So it always chose the dock container layout to be associated with the app menu in the fragment manager,...
I would like to be able to touch a specific part of an ImageView and display a toast.
Here is my xml file "dessintest.xml" :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:id="#+id/relative1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<ImageView
android:id="#+id/imageview1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="#drawable/dessin1"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
>
</ImageView>
<ImageButton
android:id="#+id/imageButton1"
android:background="#00000000"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="#drawable/image" />
</RelativeLayout>
Then here is my main file "DessinTest.java" :
public class DessinTest extends Activity {
ImageButton imageButton;
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.dessintest);
addListenerOnButton();
Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.dessin1);
TouchImageView touch = new TouchImageView(this);
touch.setImageBitmap(bm);
touch.setMaxZoom(4f); //change the max level of zoom, default is 3f
setContentView(touch);
}
public void addListenerOnButton() {
imageButton = (ImageButton) findViewById(R.id.imageButton1);
imageButton.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View arg0) {
Toast.makeText(DessinTest.this,"Click !", Toast.LENGTH_SHORT).show();
}
});
}
}
When I try that, I can zoom the ImageView but I cannot see the ImageButton.
When I delete this bit of code (the one for the zooming of my ImageView) :
Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.dessin1);
TouchImageView touch = new TouchImageView(this);
touch.setImageBitmap(bm);
touch.setMaxZoom(4f); //change the max level of zoom, default is 3f
setContentView(touch);
it is working, I can see the ImageButton and click on it.
What I would like is to have both functionnalities, click and zoom.
Thanks !
OK I resolved my problem by using this sample :
https://github.com/chrisbanes/PhotoView/blob/master/sample/src/uk/co/senab/photoview/sample/SimpleSampleActivity.java
I can now zoom and touch/detect specific parts of the screen. It works very well !