经过长达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. 【spring boot】SpringBoot初学(6)– aop与自定义注解

    前言 github: https://github.com/vergilyn/SpringBootDemo 一.AOP 官方demo:https://github.com/spring-project ...

  2. Building a Space Station POJ - 2031 三维最小生成树,其实就是板子题

    #include<iostream> #include<cmath> #include<algorithm> #include<cstdio> usin ...

  3. git Auto packing the repository in background for optimum performance

    遇到问题: git本地仓库,如果长时间不进行清理,几个月以后的某一天,可能拉取代码的时候突然提示你 git Auto packing the repository in background for ...

  4. Android_关于自定义view的dialog有黑影的问题

    跟默认选中的主题有关 在build段代码中加入这行代码 dialog.getWindow().setBackgroundDrawableResource(android.R.color.transpa ...

  5. easyUI footer 的格式渲染

    网上好多的例子,但是自己使用的情况下还是出现bug.比如以下代码: var myview = $.extend({}, $.fn.datagrid.defaults.view, { renderFoo ...

  6. xampp安装配置比较容易卡住的地方

    xampp作为一款集成建站软件,方便了不少初学的开发者,但是虽然是集成和傻瓜式的安装,还是会遇到一些容易卡壳的地方,这里记录自己觉得一些比较重要的东西. 1.端口问题 如图是我改之后的端口,原来端口为 ...

  7. 0级搭建类012-Windows Server 2019安装(2019) 公开

    项目文档引子系列是根据项目原型,制作的测试实验文档,目的是为了提升项目过程中的实际动手能力,打造精品文档AskScuti. 项目文档引子系列目前不对外发布,仅作为博客记录.如学员在实际工作过程中需提前 ...

  8. 0级搭建类002-Oracle Linux 8.x安装(OEL 8.0) 公开

    项目文档引子系列是根据项目原型,制作的测试实验文档,目的是为了提升项目过程中的实际动手能力,打造精品文档AskScuti. 项目文档引子系列目前不对外发布,仅作为博客记录.如学员在实际工作过程中需提前 ...

  9. nodepad++ | 变成 _

    点击右下角切换

  10. Navicat Premium怎么设置字段的唯一性(UNIQUE)?

    参考链接:https://blog.csdn.net/Song_JiangTao/article/details/82192189 1.打开你想要设计的表 这里写图片描述2.清楚你想要设计哪个字段为唯 ...