I'm looking for an example project for Eclipse demonstrating Skype video calling on Android. I've tried a number of Skype intent implementations from Stack Overflow but cannot get the projects to build or run. I am a beginner, so I need a complete implementation and project that I can import as well as instructions for doing this on Eclipse.
The following code shows my App's current state:
package com.example.newpro;
import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
public class MainActivity extends Activity
{
public void sendMessage(View view)
{
Intent skypeIntent = new Intent(Intent.ACTION_VIEW);
String contactUserName="nithya92";
skypeIntent.setData(Uri.parse("skype:" + contactUserName +
"?call&video=true"));
//make call only then use bellow given code
//skypeIntent.setData(Uri.parse("skype:" + contactUserName+ "?call"));
skypeIntent.setComponent(new ComponentName("com.skype.raider",
"com.skype.raider.Main"));
skypeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
MainActivity.this.startActivity(skypeIntent);
}
#Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
#Override
public boolean onCreateOptionsMenu(Menu menu)
{
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final Button skype=(Button)findViewById(R.id.skypevideocall);
final EditText edit = (EditText)findViewById(R.id.editText1);
// Skype Video call button click event code here
skype.setOnClickListener(new OnClickListener()
{
#Override
public void onClick(View v)
{
String skypeName = edit.getText().toString();
if(skypeName.length()< 6)
Toast.makeText(getApplicationContext(), "Invalid Username:Minimun 6 Character",Toast.LENGTH_LONG).show();
Uri skypeUri = Uri.parse("skype:"+skypeName+"?call&video=true");
Intent myIntent = new Intent(Intent.ACTION_VIEW);
myIntent.setData(skypeUri);
startActivity(myIntent);
}
});
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
Add the following details in manifest file,
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.CALL_PRIVILEGED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
Related
I created a simple example application that creates a button in MainActivity to call the SecondActivity.
The application works well.
But I found something strange.
If I press the home key to go outside and run the launcher of the application, it returns to Main Activity, not SecondActivity.
Through a search, I got the following guide:
Intent intent = new Intent(MainActivity.this, SecondMainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); //<- add option
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); //<- add option
startActivity(intent);
This confirmed that the Activity was maintained as I wanted.
However, when using the back key, the application program ended without returning to MainActivity!
The questions I want to ask are as follows.
How to maintain SecondActivity when I press the home key to go outside and run the program again without terminating the program in SecondActivity.
How to return to Main Activity when I press the back key in Second Activity.
I hope 1) and 2) will be satisfied at once.
Source code is as follows
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapplication2">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".SecondMainActivity"
android:label="SecondMainActivity"></activity>
</application>
</manifest>
MainActivity
package com.example.myapplication2;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.content.Intent;
import android.view.View;
import android.widget.Button;
public class MainActivity extends AppCompatActivity {
Button GoToNewActivity;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
GoToNewActivity = (Button)findViewById(R.id.button1);
GoToNewActivity.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
// Intent code for open new activity through intent.
Intent intent = new Intent(MainActivity.this, SecondMainActivity.class);
// //[1]
// //intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
// //intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//
// //[2]
// intent.addFlags(intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
});
}
}
SecondMainActivity
package com.example.myapplication2;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
public class SecondMainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_second_main);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.second_main, menu);
return true;
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
You can download the application source.
1.If you going to home screen that because of your app is restarting
android system clear memory automatically after some time.
2.You don't need "intent.flag" tags , just start the activity and as Gunesh Shanbhag said in comment activity are arranged in stack. You
don't need to write code for that is automatic process but you can
ovveride the onbackpressed method to do something else like press
back button twice to exit the app.
I'm working on a university project for blind people who use Android phones (a Braille Keyboard) .
So i need disable talkback when user use the keyboard and then enable it again. (for using multitouch on the screen). So I created a new sample simple project for android 8.0, empty activity and I added a couple things.
My sample android manifest:
<?xml version="1.0" encoding="utf-8"?>
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
And my simple MainActivity:
package com.jaime.prueba;
import android.os.Bundle;
import android.provider.Settings;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
updateTalkBackState(true);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
}
private static final String TALKBACK_SERVICE_NAME = "com.google.android.marvin.talkback/.TalkBackService";
private void updateTalkBackState(boolean enableTalkBack) {
if (enableTalkBack) {
enableAccessibilityService(TALKBACK_SERVICE_NAME);
} else {
disableAccessibilityServices();
}
}
private void enableAccessibilityService(String name) {
Settings.Secure.putString(getContentResolver(), Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, name);
Settings.Secure.putString(getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED, "1");
}
private void disableAccessibilityServices() {
Settings.Secure.putString(getContentResolver(), Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, "");
Settings.Secure.putString(getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED, "0");
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
So...
Firstly: I checked this answer: https://stackoverflow.com/a/44461236/10802519
// It's not possible to turn TalkBack on or off from within your app unless you have been granted the system permission WRITE_SECURE_SETTINGS (via ADB) by the user.
private static final String TALKBACK_SERVICE_NAME = "com.google.android.marvin.talkback/.TalkBackService";
private void updateTalkBackState(boolean enableTalkBack) {
if (enableTalkBack) {
enableAccessibilityService(TALKBACK_SERVICE_NAME);
} else {
disableAccessibilityServices();
}
}
private void enableAccessibilityService(String name) {
Settings.Secure.putString(getContentResolver(), Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, name);
Settings.Secure.putString(getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED, VALUE_ENABLED);
}
private void disableAccessibilityServices() {
Settings.Secure.putString(getContentResolver(), Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, "");
Settings.Secure.putString(getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED, VALUE_DISABLED);
}
Secondly: In my Terminal I typed:
adb shell pm grant com.jaime.prueba android.permission.WRITE_SECURE_SETTINGS
Thirdly: But I got the following:
java.lang.SecurityException: Package com.jaime.prueba has not requested permission android.permission.WRITE_SECURE_SETTINGS
at com.android.server.pm.permission.BasePermission.enforceDeclaredUsedAndRuntimeOrDevelopment(BasePermission.java:379)
at com.android.server.pm.permission.PermissionManagerService.grantRuntimePermission(PermissionManagerService.java:1404)
at com.android.server.pm.permission.PermissionManagerService.access$900(PermissionManagerService.java:89)
at com.android.server.pm.permission.PermissionManagerService$PermissionManagerInternalImpl.grantRuntimePermission(PermissionManagerService.java:2093)
at com.android.server.pm.PackageManagerService.grantRuntimePermission(PackageManagerService.java:5411)
at com.android.server.pm.PackageManagerShellCommand.runGrantRevokePermission(PackageManagerShellCommand.java:1730)
at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:217)
at android.os.ShellCommand.exec(ShellCommand.java:103)
at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:21330)
at android.os.Binder.shellCommand(Binder.java:634)
at android.os.Binder.onTransact(Binder.java:532)
at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:2821)
at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:3856)
at android.os.Binder.execTransact(Binder.java:731)
Fourthly I build my app on Android Studio, Everything fine, nothing red, so I run the app on my phone... and my app does not open, it does not work.
I hope my question is understandable. Let me know, if my questions need something more -First question, and in foreign language- Thank you!
Notice in manifest file:
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
but in terminal you input:
adb shell pm grant com.jaime.prueba android.permission.WRITE_SECURE_SETTINGS
WRITE_SETTINGS and WRITE_SECURE_SETTINGS are two different permissions.
and about WRITE_SECURE_SETTINGS, you could read this post.
I created a wallpapers and ringtones app.
Wallpapers and Ringtones are 2 buttons.
These 2 buttons open each other a new page.
In the wallpapers page I have a button which I want to open a new page, but it doesn't work.
Below I pasted java and the manifest from android studio.
Main activity java:
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
public void onButtonClicks(View c) {
if (c.getId() == R.id.Bdisplay) {
Intent i = new Intent(MainActivity.this, display.class);
startActivity(i);
overridePendingTransition(R.animator.animation1, R.animator.animation2);
}
}
public void onClick (View v) {
if (v.getId() == R.id.Bdisplay) {
Intent intent = new Intent(MainActivity.this, display.class);
startActivity(intent);
overridePendingTransition(R.animator.animation1, R.animator.animation2);
}
}
public void onButtonClick(View x) {
if (x.getId() == R.id.Bdisplay) {
Intent i = new Intent(MainActivity.this, ringtone.class);
startActivity(i);
overridePendingTransition(R.animator.animation1, R.animator.animation2);
}
}
ringtone java code:
import android.app.Activity;
import android.os.Bundle;
public class ringtone extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.ringtone);
}
display(the name for wallpapers) java code:
import android.app.Activity;
import android.os.Bundle;
public class display extends Activity
{
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.display);
}
}
And the java code for the new page:
import android.app.Activity;
import android.os.Bundle;
public class newpage extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".display"></activity>
<activity android:name=".ringtone"></activity>
<activity android:name=".newpage"></activity>
</application>
</manifest>
What is am I doing wrong?
I have some suggestions for you:
Always name Activities with capital letter and camelcase: NewPage instead of newpage and Ringtone instead of ringtone. this helps you with variables/activities & methods identifications.
Calling an OnClick method use an explicit way.
Do like this:
Button button = (Button) findViewById(R.id.button);
button.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View arg0) {
//do stuffs here
}
});`
than yes, you always call the same class, probably this is why it doesn't work ;)
EDIT: to fix the problem try this:
in your Activities u have two buttons which send users to ringtones or wallpapers. Imagine they are called WallpaperButton and RingtoneButton; both in the activity called MainActivity, this activity should look like:
public class MainActivity extends AppCompatActivity {
Button btnRingtone, btnWallpaper;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btnRingtone = (Button) findViewById(R.id.RingtoneButton);
btnWallpaper = (Button) findViewById(R.Id.WallpaperButton);
btnRingtone.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View arg0) {
//Call the ringtone activity as "RingtoneActivity"
Intent i = new Intent(MainActivity.this, RingtoneActivity.class);
StartActivity(i);
}
});`
btnWallpaper.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View arg0) {
//Call the wallpaper activity as "WallpaperActivity"
Intent i = new Intent(MainActivity.this, WallpaperActivity.class);
StartActivity(i);
}
});`
}
}
With this code in your mainactivity if an user clicks on the button wallpaper, he goes to wallpaper activity, if he clicks on button ringtone he goes to ringtone activity.
Do the same with the NewPageActivity. If you have trouble on how to create "SetOnClickListener" look here for an example.
If you have troubles or questions feel free to ask :)
I am trying to use webView to display an HTML file that is on the device and not the internet. I have my html files in the /Download folder. When I launch the application I get the following error:
Webpage not available
The webpage at file:///storage/sdcard0/Download/manuals/test/index4.html might be temporarily down or it may have been moved permanently to a new web address.
I know the file is there but it will not display it.
Here is my code:
package com.asstechmanuals.techmanual;
import java.io.File;
import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.Window;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class MainActivity extends Activity {
private WebView mWebView;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);
File fileStandard = new File("/storage/sdcard0/Download/manuals/test/index4.html");
File fileNewStandard = new File("/storage/sdcard0/Download/manuals/test/index4.html");
File fileKitKat = new File("/storage/sdcard0/Download/manuals/test/index4.html");
if(fileStandard.exists())
mWebView.loadUrl("file:///storage/sdcard0/Download/manuals/test/index4.html");
else if(fileNewStandard.exists())
mWebView.loadUrl("file:///storage/sdcard0/Download/manuals/test/index4.html");
else if(fileKitKat.exists())
mWebView.loadUrl("file:///storage/sdcard0/Download/manuals/test/index4.html");
else
mWebView.loadUrl("file:///storage/sdcard0/Download/manuals/test/index4.html");
mWebView.setWebViewClient(new vwClient());
}
private class vwClient extends WebViewClient{
#Override
public boolean shouldOverrideUrlLoading(WebView webview, String url)
{
webview.loadUrl(url);
if (url.toLowerCase().contains(".pdf"))
{
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(url), "application/pdf");
startActivity(intent);
}
return true;
}
}
#Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
if ((keyCode == KeyEvent.KEYCODE_BACK) && mWebView.canGoBack())
{
mWebView.goBack();
return true;
}
return super.onKeyDown(keyCode, event);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
In your manifest xml file, make sure you have permission to read that folder for your app and permission to use internet (even though you actually are not, it is still required).
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
I've tried to develop my own app but now that i wanna see how it looks on my phone it says "Appname has stopped". Im installing the app via dropbox.
Here's a copy of the MainActivity.java
package com.example.aikk;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button mBtn1 = (Button) findViewById(R.id.northpowerramsor);
mBtn1.setOnClickListener((OnClickListener) this);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
/** Called when the user clicks the Send button */
public void onClick(View view) {
Log.i("clicks","You Clicked B1");
Intent i=new Intent(MainActivity.this, Ramsor.class);
startActivity(i);
// Do something in response to button
}
}
And here's a copy of Ramsor.java
public class Ramsor extends Activity {
#SuppressLint("NewApi")
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.activity_Ramsor);
//Vettefan var det här är till med när jag skulle göra quick fix på den kom jag till nån knas layout sida
// Make sure we're running on Honeycomb or higher to use ActionBar APIs
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
// Show the Up button in the action bar.
getActionBar().setDisplayHomeAsUpEnabled(true);
}
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
}
}
And the Android.Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.aikk"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="1"
android:targetSdkVersion="19"
android:maxSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.aikk.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.aikk.Ramsor"
android:label="#string/title_activity_ramsor"
android:parentActivityName="com.example.AIKK.MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.AIKK.MainActivity" /> >
</activity>
</application>
</manifest>
Any thoughts would be GREATLY appreciated!
The problem is here , you are trying to cast the activity(this) to OnClickListener
mBtn1.setOnClickListener((OnClickListener) this);
The solution is to make your activity implements OnClickListener and create the unimplemented method
public class MainActivity extends Activity {
should be
public class MainActivity extends Activity implements OnClickListener {
There can be other reasons for the crash as well in which case it is better you post the stacktrace.
You can do as below using annonymous inner class
mBtn1.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
// do something
}
});
Change your class definition to implement OnClickListener:
public class MainActivity extends Activity implements OnClickListener {
...and set the click listener on mBtn1 as follows:
mBtn1.setOnClickListener(this);
try below this instead of mBtn1.setOnClickListener((OnClickListener) this);
mBtn1.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View view) {
// Activity to do onclick .
}
});
return true;