记吾爱的!教我兄弟学Android逆向01 编写第一个Android程序

尝试学习吾爱的Android逆向!从零开始!在此记录进程!

弄了一个乱乱的UI界面


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_margin="20dp"
    android:orientation="vertical">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
        <TextView
            android:id="@+id/tv_name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="20dp"
            android:text="姓名:"/>
        <EditText
            android:id="@+id/ed_name"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            android:hint="请输入你的姓名!"/>
    </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
        <TextView
            android:id="@+id/tv_age"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="20dp"
            android:text="年龄:"/>
        <EditText
            android:id="@+id/ed_age"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            android:hint="请输入你的年龄!"/>
    </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="18dp"
            android:text="请选择你出生日期:"/>
        <TextView
            android:id="@+id/tv_date"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"/>
    </LinearLayout>
    <Button
        android:id="@+id/bt_time"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:layout_gravity="center"
        android:text="选择日期"/>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="18dp"
            android:text="请输入你的邮箱:"/>
        <EditText
            android:id="@+id/ed_email"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            android:hint="请输入你的邮箱!"/>
    </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="请选择你的兴趣爱好:"/>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:orientation="horizontal">
            <CheckBox
                android:id="@+id/cb_a"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Android"/>
            <CheckBox
                android:id="@+id/cb_b"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="IOS"/>
            <CheckBox
                android:id="@+id/cb_c"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="吹水"/>
        </LinearLayout>
    </LinearLayout>
    <Button
        android:id="@+id/bt_login"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:text="提交"/>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="18dp"
            android:text="用户名:"/>
        <EditText
            android:id="@+id/ed_username"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content"/>
    </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="18dp"
            android:text="密    码:"/>
        <EditText
            android:id="@+id/ed_password"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content"/>
    </LinearLayout>
    <Button
        android:id="@+id/bt_go"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:layout_gravity="center"
        android:text="登录"
        />
</LinearLayout>

然后还有一个点击中间那个提交按钮之后跳转的页面


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_margin="20dp"
    android:orientation="vertical">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="20dp"
        android:orientation="horizontal">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="姓名:"/>
        <TextView
            android:id="@+id/tv_cname"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content"/>
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="20dp"
        android:orientation="horizontal">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="年龄:"/>
        <TextView
            android:id="@+id/ctv_cage"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content"/>
    </LinearLayout>


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="20dp"
        android:orientation="horizontal">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="邮箱:"/>
        <TextView
            android:id="@+id/tv_cemail"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content"/>
    </LinearLayout>


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="20dp"
        android:orientation="horizontal">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="生日:"/>
        <TextView
            android:id="@+id/tv_ctime"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content"/>
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="20dp"
        android:orientation="horizontal">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="爱好:"/>
        <TextView
            android:id="@+id/tv_ccb"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content"/>
    </LinearLayout>


</LinearLayout>

布局就2个 搞定之后 就开始我们的逆向之旅了

首先在MainActivity中声明控件,以及传值,监听事件! 当然登录功能没做跳转,只是弹幕提醒登录成功失败与否而已!

package com.example.administrator.pj_001;


import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.DatePickerDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends Activity implements View.OnClickListener{
    //声明各个控件
    private TextView tv_date;
    private Button bt_time;
    private Button bt_login;
    private Button bt_go;
    private EditText ed_name;
    private EditText ed_age;
    private EditText ed_email;
    private EditText ed_username;
    private EditText ed_password;
    private CheckBox cb_a;
    private CheckBox cb_b;
    private CheckBox cb_c;
    //存放ChecBox多选的内容
    StringBuffer sb = new StringBuffer();
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        //初始化控件
        initView();
        //为按钮添加监听事件
        bt_time.setOnClickListener(this);
        bt_login.setOnClickListener(this);
        bt_go.setOnClickListener(this);
    }
    //初始化控件
    private void initView() {
        tv_date =  findViewById(R.id.tv_date);
        bt_time =  findViewById(R.id.bt_time);
        bt_login = findViewById(R.id.bt_login);
        bt_go =  findViewById(R.id.bt_go);
        ed_name = findViewById(R.id.ed_name);
        ed_age = findViewById(R.id.ed_age);
        ed_email = findViewById(R.id.ed_email);
        cb_a = findViewById(R.id.cb_a);
        cb_b = findViewById(R.id.cb_b);
        cb_c = findViewById(R.id.cb_c);
        ed_username = findViewById(R.id.ed_username);
        ed_password = findViewById(R.id.ed_password);
    }

    @Override
    public void onClick(View v) {
        switch(v.getId()){
            //点击选择日期的时候,使用DataPickerDialog弹框选择
            case R.id.bt_time:
                new DatePickerDialog(MainActivity.this,new DatePickerDialog.OnDateSetListener(){

                    @SuppressLint("DefaultLocale")
                    @Override
                    public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
                        tv_date.setText(String.format("%d-%d-%d",year,month+1,dayOfMonth));
                        Toast.makeText(MainActivity.this,tv_date.getText().toString(),Toast.LENGTH_SHORT).show();
                    }
                },2018,6,21).show();
                break;
            case R.id.bt_login:
                //跳转到另外一个Activity,并把页面参数带过去!
                Intent intent = new Intent(MainActivity.this,Client.class);
                //实例化一个Bundle
                Bundle bundle = new Bundle();
                //存入数据
                bundle.putString("name",ed_name.getText().toString());
                bundle.putString("age",ed_age.getText().toString());
                bundle.putString("time",tv_date.getText().toString());
                bundle.putString("email",ed_email.getText().toString());
                //判断是否选中,选中的状态下把多选框的值存入StringBuffer
                if(cb_a.isChecked()){
                    sb.append(cb_a.getText().toString()+" ");
                }
                if(cb_b.isChecked()){
                    sb.append(cb_b.getText().toString()+" ");
                }
                if(cb_c.isChecked()) {
                    sb.append(cb_c.getText().toString() + " ");
                }
                Toast.makeText(MainActivity.this,sb.toString(),Toast.LENGTH_LONG).show();
                bundle.putString("cb",sb.toString());
                //存入数据
                intent.putExtras(bundle);
                //跳转Activity
                startActivity(intent);
                break;
            case R.id.bt_go:
                //判断账号密码是否是admin
                if(ed_username.getText().toString().equals("admin") && ed_password.getText().toString().equals("admin")){
                    Toast.makeText(MainActivity.this,"登录成功!",Toast.LENGTH_SHORT).show();
                }else{
                    Toast.makeText(MainActivity.this,"账户或密码错误!!",Toast.LENGTH_SHORT).show();
                }
        }
    }
}

整体代码都差不多完成了,但是我们跳转后页面的代码也不能少了!主要就是取到上一个页面传来的值,取出并赋值给当前的控件显示出来!

package com.example.administrator.pj_001;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.widget.TextView;

public class Client extends Activity{
    private TextView tv_cname;
    private TextView tv_cage;
    private TextView tv_ctime;
    private TextView tv_cemail;
    private TextView tv_ccb;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.client);
        //初始化控件
        initView();
        //获取传过来的值
        Bundle bundle = this.getIntent().getExtras();
        //取出获取的值并赋值给控件
        tv_cname.setText(bundle.getString("name"));
        tv_cage.setText(bundle.getString("age"));
        tv_ctime.setText(bundle.getString("time"));
        tv_cemail.setText(bundle.getString("email"));
        tv_ccb.setText(bundle.getString("cb"));
    }

    //初始化控件
    public void initView(){
        tv_cname = findViewById(R.id.tv_cname);
        tv_cage = findViewById(R.id.ctv_cage);
        tv_ctime = findViewById(R.id.tv_ctime);
        tv_cemail = findViewById(R.id.tv_cemail);
        tv_ccb = findViewById(R.id.tv_ccb);
    }
}

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
网传资源,如有侵权请联系/留言,资源过大,上传乃是下载链接,失效请留言,下面上大纲: 01.Android环境配置与常用工具介绍 02.Android smali 与 java 代码介绍1 : d% y( z) X- o& ~, e0 _; c1 I 03.Android smali 与 java 代码介绍2 c+ K& I/ q( b 04.Android smali 与 java 代码介绍3 % ]7 Z+ f! I! [5 S. O. N 05.Android smali 与 java 代码介绍4 7 A9 G6 c k; B 06.Android smali 与 java 代码介绍5 ; [. D3 O0 ~9 _0 ]3 W 07.常用Android快速定位关键点方法介绍 " v+ h0 Z5 x& }1 o4 c/ L 08.从0开始打造自己的破解代码库 09.Android 结构基础讲解 10.快速Hook代码搭建之 Cydia Substrate 11.快速Hook代码搭建之 Xposed 12.安装部署Android源码编译环境 13.Android源码目录结构与修改引导 / |3 T: f, f8 [2 @+ p 14.Android源码修改与刷机介绍 & D- q# v- o) o) ?/ u( A 15.Android Jni 编程 & Y6 ^/ J* G3 ] 16.arm 汇编代码讲解1 . J) E# f# h! Q4 x2 P+ K 17.arm 汇编代码讲解2 18.arm 汇编代码讲解3 19.arm 汇编代码讲解4 20.arm 汇编代码讲解5 ' B! y1 m7 _% U8 r2 G! R% h& L! a4 J0 B 21.class.dex文件格式讲解 22.Android 动态代码自修改原理 23.Android 动态代码自修改实现1 . F; Z5 @* D* r 24.Android 动态代码自修改实现2 25.Android dvm 脱壳1 26.elf结构详解1, d9 H, S" s2 }8 j' B6 v 27.elf结构详解2 8 A9 q+ O" `- v 28.elf文件变形与保护 1 g, b1 q, P( P& W, k3 F7 U 29.elf文件修复分析 9 K p" k/ `- s, w/ r: R( X 30.so加壳文件修复 31.常用调试检测方法与过检测方法 * G( L. J' P1 \+ }: N; r 32.Android源码定制添加反反调试机制 ' v/ q6 K1 {6 ] 33.Android dvm 脱壳2 34.Android dvm 脱壳3 H2 X- A# M4 s+ A6 K- b 35.Dalvik dex处理分析 ) x+ l1 l1 J R2 N) T" R) ^2 o 36.IDA脱壳脚本编写1) O7 `% E" Q. @1 X! o ~ 37.Odex修复方法 38.IDAOdex修复脚本编写 " X' w1 h: w3 N" u8 P5 z 39.Android 加壳原理 40.Android 加壳保护工具编写1 1 x4 k0 P/ V' C9 a( O 41.Android 加壳保护工具编写2 42.Android 加壳保护工具编写3

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值