I have two activities:
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void click(View view) {
Intent intent= new Intent(this, TranslucentActivity.class);
startActivity(intent);
}
}
public class TranslucentActivity extends Activity
I want to turn the android screen on button click,Now i had written a program for this in is not showing any errors also its not working..
The code for this is..
public class MainActivity extends Activity {
Button powerOff;
int amountOfTime =20*1000;
Context context = this;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(
I have a button that links to another activity, when I click on it it goes to the layout.xml I want it to
This is the java file for the main/first screen
Button button;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
addListenerOnButton();
}
public void addListenerOnButton() {
final Context context
I am creating a simple app in eclipse but I am getting error at this line
b.setOnClickListener(new OnClickListener()
please have a look at the entire program
package com.example.activity2;
public class Main extends Activity {
//Called when the activity is first created.
I want to lock the screen of the app on button click
I have written the code as
public class MainActivity extends DeviceAdminReceiver{
public void makeTest()
{
System.out.println("Entered Main Class");
}
public class Controller extends Activity {
static final int RESULT_ENABLE = 1;
Button powerOff;
int amountOfTime =20*1000;
Context context = this;
DevicePolicyManager mDPM;
ActivityManag
I've just began on a new application and I added a button which in the past I've had no problem with but for some reason Its not working now. I'm just simply trying to teacher that button to another page. What do you think the problem is?
Here is my code:
public class TestActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
start();
}
private void start() {
setContentView(R.layout.main);
LinearLayout layout = (LinearLayout) findViewById(R.id.linearLayout);
Button button = new Button(this);
I am learning to make android apps and I have a problem with my hello world programs buttons.
Here's my code:
package com.Norwood.helloandroid; import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import android.view.View;
import android.widget.Toast;
public class MainActivity extends Activity {
/** Called when the activity is first created.
My application works fine on an emulator but when i run it on tablet. I get nullpointer exception.