经过长达7天多的时间,从Android studio的安装碰到很多的问题,真的很不走运,别人安装Android studio都是一气呵成,我的Android真的没话说

把自己的这些天的开发成果展示一下

做的还是很粗略,感觉自己应该多敲一些代码啦,敲代码太慢了,还有很多不懂的,

现在我总结一下这些天遇到的问题

首先是关于Android的安装问题,起初呢,我想用esplise来做一下软件,但是同学们说软件只能由Android才能打包,esolise不能用于打包,不知道是对的还是错的,不过esplise我也安装了,需要下载ADT和sdk插件,具体方法可以网上查到,想要用esplise的同学可以试试

然后是我遇到的安装android studio的问题

首先是证书问题,我觉的应该不是网络问题,可是就是安装不好,试了很多种办法,虽然安装了证书之后可以用了,但是过了几天之后又不能用了,后来查到了很多资料,感觉可能是因为gradle没有安装好,我去网上搜集了资料,查到需要配置环境,然而,在安装Android studio的时候并没有配置,然后尝试了一下重新删除gradle',按照网上的方法找到了自己的版本,由重新导入,安装,配置环境变量,终于可以了

哈哈哈,然后就是自己手贱,不小心突然又给gradle升级了,结果。。。又是没有查找到有效证书,又按照原方法,重新做了一遍,赶紧把升级提醒关闭了。。无奈呀

还有一些问题我在前几天的博客里说了,现在就不重复了

最后展示一下代码,貌似在有些手机上会闪退,在接下来的几天里会加以改良

package com.example.bank;

import android.database.Cursor;
import android.os.Bundle; import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar; import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar; import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ListView; import java.util.ArrayList;
import java.util.List; public class MainActivity extends AppCompatActivity {
private List<CostBean> mCostBeanList;
private DatabaseHelper mDatabaseHelper;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar); mDatabaseHelper=new DatabaseHelper(this);
mCostBeanList=new ArrayList<>();
ListView costList=(ListView) findViewById(R.id.lv_main);
initCostData();
costList.setAdapter(new CostListAdapter(this,mCostBeanList)); FloatingActionButton fab = 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 void initCostData() {
mDatabaseHelper.deleteAllData();
for (int i=0;i<6;i++) {
CostBean costBean=new CostBean();
costBean.costTitle=i+"mook";
costBean.costDate="11-11";
costBean.costMoney="20";
mDatabaseHelper.insertCost(costBean);
}
Cursor cursor= mDatabaseHelper.getAllCostData();
if(cursor !=null)
{
while(cursor.moveToNext()){
CostBean costBean=new CostBean();
costBean.costTitle=cursor.getString(cursor.getColumnIndex("cost_title"));
costBean.costDate=cursor.getString(cursor.getColumnIndex("cost_date"));
costBean.costMoney=cursor.getString(cursor.getColumnIndex("cost_money"));
mCostBeanList.add(costBean);
}
cursor.close();
}
} @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);
}
}
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="80dp">
<TextView
android:id="@+id/tv_title"
android:layout_width="200dp"
android:layout_height="80dp"
android:layout_alignParentLeft="true"
android:gravity="center"
android:singleLine="true"
android:text="costTitle"
android:ellipsize="marquee"
android:layout_marginLeft="10dp"
android:textSize="35sp" />
<TextView
android:id="@+id/tv_date"
android:layout_width="wrap_content"
android:layout_height="80dp"
android:gravity="center"
android:textSize="20sp"
android:layout_marginLeft="15dp"
android:layout_toRightOf="@id/tv_title"
android:text="costDate"
/>
<TextView
android:id="@+id/tv_cost"
android:layout_width="wrap_content"
android:layout_height="80dp"
android:gravity="center"
android:layout_alignParentRight="true"
android:textSize="30sp"
android:layout_marginRight="20dp"
android:text="30"
/> </RelativeLayout>
package com.example.bank;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper; import androidx.annotation.Nullable; public class DatabaseHelper extends SQLiteOpenHelper { public DatabaseHelper(@Nullable Context context) {
super(context, "imooc_daily", null, 1);
} @Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("creat table if not exists imooc_cost("+
"id integer primary key,"+
"cost_title varchar,"+
"cost_date varchar,"+
"cost_money varchar)");
}
public void insertCost(CostBean costBean)
{
SQLiteDatabase database=getWritableDatabase();
ContentValues cv=new ContentValues();
cv.put("cost_title",costBean.costTitle);
cv.put("cost_date ",costBean.costDate);
cv.put("cost_money",costBean.costMoney);
database.insert("imooc_cost",null,cv);
}
public Cursor getAllCostData(){
SQLiteDatabase database=getWritableDatabase();
return database.query("imooc_cost",null,null,null,null,null,"cost_date "+"ASC"); }
public void deleteAllData(){
SQLiteDatabase database=getWritableDatabase();
database.delete("imooc_cost",null,null);
} @Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { }
}
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".MainActivity"
tools:showIn="@layout/activity_main"> <ListView
android:id="@+id/lv_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
/> </RelativeLayout>

做的还不算太好,有些毛病

家庭记账小账本Android studio的更多相关文章

  1. 微信小程序--家庭记账小账本(三)

    家庭记账小账本打算先通过微信小程序来实现,昨天就去注册了解了一下微信小程序,感觉比较复杂而且困难.如何将ecplise源代码与小程序连接,如何建立数据库等等都困扰了我.查阅网上的资料也没有很大的进展. ...

  2. 微信小程序--家庭记账小账本(五)

    (源码已上传至github,https://github.com/xhj1074376195/CostBook_weixin) 今天,尝试弄了账单的表,发现还是弄不了,于是就把账单上的删除功能给去了, ...

  3. 微信小程序--家庭记账小账本(四)

    今天的进展不太顺利,总的账单表,代码改了又改,最后决定用一个新的表,账单界面中弄了一天删除,发现都无法实现想要的效果,于是把账单界面的删除功能去了,就感觉大功告成的时候,发现收入和支出界面的删除也出现 ...

  4. Eclipse,到了说再见的时候了——Android Studio最全解析

    转自:http://blog.jobbole.com/77635/ 去年的Google大会上,Google带给我们一个小玩具——Android Studio,说它是玩具,是因为它确实比较菜,界面过时, ...

  5. Android_小账本小结

    登录界面:支持登录.注册以及游客登录,单纯的小账本的话其实用不到这些个登录,单纯为了巩固学习知识. 尚未部署到服务器,账号等数据暂时保存在本地数据库中. 游客登陆:游客登录会直接跳到主页中,不影响使用 ...

  6. Android实战项目——家庭记账本设计思路

    经过三周左右的Android学习,实感只有上手开发才能有所提高.在此打算做一个家庭记账APP,同时巩固一下学到的东西并且弥补漏洞. 概述 记账是自古以来人类必不可少的一件事,从古代的算盘,到手写账本, ...

  7. 最强 Android Studio 使用小技巧和快捷键

    写在前面 本文翻译自 Android Studio Tips by Philippe Breault,一共收集了62个 Android Studio 使用小技巧和快捷键. 根据这些小技巧的使用场景,本 ...

  8. 如何处理Android Studio 上面关于 update 和 commit 小箭头的消失

    问题: android studio 在关联 SVN 或者 git 服务后,会在工具栏出现 update 和 commit 小箭头 如图: 但是,有时你打开工程的时候,发现这两个小箭头却消失不见了 如 ...

  9. Android课程---Android Studio使用小技巧:提取方法代码片段

    这篇文章主要介绍了Android Studio使用小技巧:提取方法代码片段,本文分享了一个快速复制粘贴方法代码片段的小技巧,并用GIF图演示,需要的朋友可以参考下 今天来给大家介绍一个非常有用的Stu ...

随机推荐

  1. Xamarin.Forms弹出对话框插件

    微信公众号:Dotnet9,网站:Dotnet9,问题或建议,请网站留言: 如果您觉得Dotnet9对您有帮助,欢迎赞赏. Xamarin.Forms弹出对话框插件 内容目录 实现效果 业务场景 编码 ...

  2. Spark学习之路 (二十)SparkSQL的元数据[转]

    概述 SparkSQL 的元数据的状态有两种: 1.in_memory,用完了元数据也就丢了 2.hive , 通过hive去保存的,也就是说,hive的元数据存在哪儿,它的元数据也就存在哪儿. 换句 ...

  3. Open Live Writer(olw)博客写作软件

    前言 wlw似乎不再提供下载了,从微软的官网下载安装程序之后,无法联网下载olw组件,所以写博客改用olw. olw是wlw的开源版本,所以wlw上的操作是可以在olw上继续使用的. 关于wlw的知识 ...

  4. AGC001 E - BBQ Hard [组合数]

    这题就是要求 \(\sum_{i=1}^{n} \sum_{j=i+1}^{n} C(a_i+a_j+b_i+b_j,a_i+a_j)\) 考虑搞一搞,\(C(a_i+a_j+b_i+b_j,a_i+ ...

  5. NC反弹shell的几种方法

    假如ubuntu.CentOS为目标服务器系统 kali为攻击者的系统,ip为:192.168.0.4,开放7777端口且没被占用 最终是将ubuntu.CentOS的shell反弹到kali上 正向 ...

  6. linux c++调试日志函数

    #ifndef MYLOG_H #define MYLOG_H #include <stdio.h> #define __DEBUG__ #ifdef __DEBUG__ #define ...

  7. stylelint

    "number-leading-zero": "never", // 去掉小数点前面的0 "prettier.stylelintIntegration ...

  8. 实用沙盒工具 —— VMware Workstation15安装教程

    一:简介 VMware Workstation(中文名"威睿工作站")是一款功能强大的桌面虚拟计算机软件,提供用户可在单一的桌面上同时运行不同的操作系统,和进行开发.测试 .部署新 ...

  9. LaTeX技巧010:LaTtex中如何给每个句子加序号?

    效果图: 代码: \documentclass{article} \newcounter{sentence} \renewcommand\thesentence{\textsuperscript{\a ...

  10. POJ2528Mayor's posters 线段树,离散化技巧

    题意:一个坐标轴从1~1e7,每次覆盖一个区间(li,ri),问最后可见区间有多少个(没有被其他区间挡住的) 线段树,按倒序考虑,贴上的地方记为1,每次看(li,ri)这个区间是否全是1,全是1就说明 ...