Reputation: 4594
I have an app in android in which I wanna achieve the following thing:
I want to click on an image on android mobile through python script.
Does anyone know how could I achieve that?
Upvotes: 0
Views: 962
Reputation: 1474
Please try this whenever you want to move from one activity to another activity..
Intent myIntent = new Intent(CurrentActivity.this,NextActivity.class);
myIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(myIntent);
Above code will take you from CurrentActivity to NextActivity....
Whenever you want that to happen just execute those three statements, that will do your work....
Upvotes: 0
Reputation: 36035
You can create a layout with a single button. Set the background of the button as the image you want. Make the button width and height to match parent. Then register the button in a normal way to start the activity. So something like this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:layout_width="match_parent"
android:id="@+id/button1"
android:layout_height="match_parent"
android:background="@drawable/background">
</Button>
</LinearLayout>
With your activity like this:
public class ActivityA extends Activity implements OnClickListener
{
@Override
public void onCreate(Bundle icicle)
{
super.onCreate(icicle);
setContentView(R.layout.main);
Button buttonA = (Button) findViewById(R.id.button1);
buttonA.setOnClickListener(this);
}
@Override
public void onClick(View v) {
final Intent intent = new Intent(getApplicationContext(), ActivityB.class);
startActivity(intent);
}
}
When the user presses "back", he or she will go back to the giant button activity.
Upvotes: 2