package com.example;
import com.example.hyptest.R;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
public class TestActivity extends Activity {
void test() {
final LinearLayout layout = new LinearLayout(this);
// layout.setOrientation(LinearLayout.VERTICAL);
Button button = new Button(this);
button.setText("Click Me");
button.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.FILL_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT));
button.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
// Starting Another Activity
Intent intent = new Intent(TestActivity.this , T2Activity.class);
//EditText editText = (EditText) findViewById(R.id.edit_message);
//String message = editText.getText().toString();
//intent.putExtra(EXTRA_MESSAGE, "abcc");
startActivity(intent);
}
});
layout.addView(button);
setContentView(layout);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
test();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_hyp_test, menu);
return true;
}
}
分享到:
相关推荐
This sample shows how to call the Google Assistant Service from Android Things using gRPC. It records a spoken request from the connected microphones, sends it to the Google Assistant API and plays ...
Android layout that simulates physics using JBox2D. Simply add views, enable physics, and watch them fall! The gif is choppy, see it in action with the sample app: Gradle Dependency Add this in your ...
Android MVP Sample Application A basic sample android application to understand MVP in a very simple way. Just clone, build, run and understand MVP. Check out Mindorks awesome open source projects ...
Sample VideoNo filter GlGlayScaleFilter apply GlMonochromeFilter apply GlWatermarkFilter apply Gradle Step 1. Add the JitPack repository to your build file allprojects { repositories { ... ...
Poly API - Android Sample Copyright (c) 2017 Google Inc. All rights reserved. This is a sample project showing how to invoke the Poly API from an Android app. Note about rendering: The focus of this ...
android-mvi-sample Example MVI implementation, based off of Google's architectural samples. Description This is a sample implementation of the Model View Intent pattern. Full Android examples for MVI...
A set of Android tools that facilitate apps development Well, this repo contains pretty much code used internally at Stanfy to develop Android apps. Some parts lack documentation and are outdated, we...
Android-WScratchView [Deprecated] PLEASE NOTE, THIS PROJECT IS NO LONGER BEING MAINTAINED, YOU ARE WELCOME TO COPY AND IMPROVE AS YOUR OWN PROJECT. PLEASE INFORM ME THE IMPROVED VERSION SO I CAN LINK ...
Android应用程序欢迎界面实现 经常使用到一些程序,因为开始的时候需要加载一些资料,或者是为了打下提示商标。往往都会在程序开始的时候加入欢迎界面。实现方法有很多种,今天就来说一下比较简单的方法吧。就是默认...
编译原理实验 语义分析与中间代码生成 Sample语言的语义和代码生成规则,熟悉Sample语言的语义分析和代码生成过
android 多屏显示sample代码, 能够把程序显示在不同的屏幕项目
This is a sample of android week view,Thanks the author of android week view ,The WeekHeaderView is based on android week view .This project contains two view ,the header view and day view.You can add...
A basic sample android application to understand MVVM in a very simple way. The app has following packages: data: It contains all the data accessing and manipulating components. ui: View classes ...
android-19 sample
Its purpose being, to quickly demonstrate Android, Kotlin and software development in general. More so and amongst others, the main focus of this project is: Setup and Gradle configuration, Gradle ...
Google Maps Android API v2 Samples ... This sample demonstrates the basic setup required for a gradle-based Android Studio project. Tutorials: Samples associated with tutorials in the develop
You can find the sample app on Google Play, just click on the logo below. How to build Simply update your gradle dependencies. build.gradle: dependencies { (...) compile('org.coderoller:...
android developer->training->sending operations to multiple threads 的例子。demo的例子叫threadSample.zip。这个例子请结合官网文档看,对android多线程处理给出了一个解决方案,写的相当好。
"mobile times 3", Android, iOS, and Windows Phone. (todo, windows phone support) Learning Mobile C Slack instance! UIKonf 2014 CppCon 2014 - A Deep Dive Into Two Cross-Platform Mobile Apps Written in...