![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
android
安達と島村
学习记录用,可能有错误的地方
展开
-
xperia sog04使用格安卡无法开热点
淘了个二手手机开热点,结果开不了,报错“エラーが起きます”。发现一开热点流量标记就没了,想更新系统也会这样。解决方法如下https://novlog.me/android/docomo-xperia-mvno-tethering/原创 2022-05-14 22:43:15 · 200 阅读 · 0 评论 -
setSupportActionBar不显示toolbar的问题
做左划菜单时,遇到的两个BUG:从toolbar.xml里加载toolbar,再设置actionbar,debug发现getSupportActionBar有值,但页面上不显示。需要将toolbar加入当前activity。menu文字不显示。样式问题导致文字和背景同色。toolbar.xml里,android:theme设置Dark使bar的文字成白色, app:popupTheme设置light使menu的文字成黑色。public class MaterialActivity1 extends原创 2021-02-28 12:09:04 · 663 阅读 · 0 评论 -
android:断点续传下载文件并实时用通知显示下载进度
代码:gethub写的很乱,下载完毕后的通知也没有实现。由于没有写回调处理downloadWithResult的返回值,所以返回值用不上。之前用asyncTask也写了一份,碰到notify通知频繁导致app很卡的问题,试着用handler来解决。最后发现是数值设置有误,导致notification每秒刷新上百次(理论上)。通过百度学习了一下东西:activity和service通过Messenger互相获取对方的handler,并发送消息。参考利用Handler实现Activity和Servi原创 2021-02-27 19:16:50 · 354 阅读 · 0 评论 -
某fragment的demo
项目要求:宽屏两列显示,左侧显示news的title的list,右侧显示content,点击title切换content;窄屏一列显示,显示news的title的list,点击title跳转content;逻辑拆分:layout里放窄屏的layout,里面只有titleFragment;layout-large放宽屏的layout,有title的fragmentFragment和contentFragment;titleFragment的类里,通过判断能否找到contentFragment原创 2021-02-20 19:28:49 · 185 阅读 · 1 评论 -
RecyclerView视图,notifyDataSetChanged失效
参考https://blog.csdn.net/lht80s/article/details/96504150 @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mAdapter = new HomeVideoAdapter(da原创 2020-12-15 00:33:16 · 339 阅读 · 0 评论 -
helloworld教程的gitee源码地址+sqlite demo
//https://gitee.com/hwdroid,已经forkpackage com.example.helloworld;import android.content.ContentValues;import android.content.Context;import android.database.Cursor;import android.database.sqlite.SQLiteDatabase;import android.os.Bundle;import androi原创 2020-12-04 20:33:57 · 300 阅读 · 0 评论 -
webview网页视图demo2
package com.example.helloworld;import android.annotation.SuppressLint;import android.net.Uri;import android.os.Build;import android.os.Bundle;import android.text.Editable;import android.view.View;import android.webkit.WebChromeClient;import androi原创 2020-12-04 20:11:06 · 237 阅读 · 0 评论 -
webview网页视图demo
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.example.helloworld"> <application android:allowBacku原创 2020-12-04 19:39:07 · 222 阅读 · 0 评论 -
handler消息传递机制demo
public class TestHandler extends AppCompatActivity { int num = 0; private TextView tv; private Handler handler = new Handler() { @Override public void handleMessage(@NonNull Message msg) { if (msg.what % 6==0) {原创 2020-12-04 14:44:19 · 77 阅读 · 0 评论 -
OKHTTP网络请求demo
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.example.helloworld"> <application android:allowBacku原创 2020-12-03 20:48:06 · 432 阅读 · 0 评论 -
SharedPreferences使用demo
package com.example.helloworld;import android.annotation.SuppressLint;import android.content.SharedPreferences;import android.os.Bundle;import android.util.Log;import android.view.View;import android.widget.ArrayAdapter;import android.widget.ListVi原创 2020-12-03 18:05:05 · 131 阅读 · 0 评论 -
fragment静态动态加载和与activity传输数据
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.example.helloworld"> <application android:allowBacku原创 2020-12-03 16:02:50 · 168 阅读 · 0 评论 -
ContentProvider组件读写联系人
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.example.helloworld"> <uses-permission android:name="android.p原创 2020-12-02 19:37:00 · 91 阅读 · 0 评论 -
静态广播注册demo
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.helloworld"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher"原创 2020-12-02 13:44:09 · 101 阅读 · 0 评论 -
动态广播注册demo
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.helloworld"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher"原创 2020-12-02 12:22:24 · 133 阅读 · 0 评论 -
bindService demo
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.helloworld"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher"原创 2020-12-01 21:42:05 · 150 阅读 · 0 评论 -
activity的创建启动,启动模式,通信方式demo
public class TestActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.horizontalscrollview); init1(); } @Ove原创 2020-12-01 21:28:32 · 72 阅读 · 0 评论 -
HorizontalScrollView(水平滚动条)组件demo
<?xml version="1.0" encoding="utf-8"?><HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content"> <LinearLayout android:layout_wi原创 2020-12-01 21:23:17 · 234 阅读 · 0 评论 -
popupwindow组件demo
public class PopupActivity extends AppCompatActivity { private Context c; PopupWindow p ; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.alertview)原创 2020-11-30 19:00:40 · 93 阅读 · 0 评论 -
4种AlertDialog组件
<?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原创 2020-11-30 11:42:27 · 116 阅读 · 0 评论 -
expandablelistview和自定义Toast的demo
//expandlists.xml<?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">原创 2020-11-29 16:46:25 · 100 阅读 · 0 评论 -
下拉列表spinner
<?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"> <TextView原创 2020-11-28 18:19:59 · 105 阅读 · 0 评论 -
recyclerview,cardview和动态修改和利用getIdentifier()方法获取资源ID
<?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"> <LinearLayou原创 2020-11-28 16:25:43 · 160 阅读 · 0 评论 -
LayoutInflater.from.inflate的参数
//News.javaimport lombok.AllArgsConstructor;import lombok.Data;import lombok.NoArgsConstructor;@Data@AllArgsConstructor@NoArgsConstructorpublic class News { private int aIcon; private String title; private String content;}//NewsAdapt原创 2020-11-27 14:09:05 · 457 阅读 · 0 评论