stability fix at main screen

This commit is contained in:
Page Asgardius 2022-10-05 12:39:38 -07:00
parent 15cfe7730d
commit 59552f0ebb
2 changed files with 19 additions and 19 deletions

View file

@ -26,6 +26,7 @@ public class MainActivity extends AppCompatActivity {
SQLiteDatabase db;
ArrayList Name;
ArrayList Img;
MyDbHelper dbHelper;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -38,7 +39,13 @@ public class MainActivity extends AppCompatActivity {
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getApplicationContext());
recyclerView.setLayoutManager(linearLayoutManager);
MyDbHelper dbHelper = new MyDbHelper(this);
dbHelper = new MyDbHelper(this);
Thread listaccount = new Thread(new Runnable() {
@Override
public void run() {
try {
//Your code goes here
db = dbHelper.getWritableDatabase();
if (db != null) {
// Database Queries
@ -54,13 +61,6 @@ public class MainActivity extends AppCompatActivity {
} else {
Toast.makeText(getApplicationContext(),getResources().getString(R.string.broken_database), Toast.LENGTH_SHORT).show();
}
Thread listaccount = new Thread(new Runnable() {
@Override
public void run() {
try {
//Your code goes here
runOnUiThread(new Runnable() {
@Override

View file

@ -35,7 +35,7 @@ public class VideoPlayer extends AppCompatActivity {
private WifiManager.WifiLock mWifiLock;
private PowerManager.WakeLock mWakeLock;
private PowerManager powerManager;
private long maxCacheSize = 100 * 1024 * 1024;
private long maxCacheSize = 1024 * 1024 * 1024;
SimpleCache simpleCache;
ExoPlayer player;
@ -55,7 +55,7 @@ public class VideoPlayer extends AppCompatActivity {
player = new ExoPlayer.Builder(this).build();
LeastRecentlyUsedCacheEvictor evictor = new LeastRecentlyUsedCacheEvictor(maxCacheSize);
simpleCache = new SimpleCache(new File(this.getCacheDir(), "media"), evictor);
MediaSource mediaSource = new ProgressiveMediaSource.Factory(new CacheDataSourceFactory(this, simpleCache, 512 * 1024 * 1024))
MediaSource mediaSource = new ProgressiveMediaSource.Factory(new CacheDataSourceFactory(this, simpleCache, maxCacheSize))
.createMediaSource(MediaItem.fromUri(Uri.parse(videoURL)));
//MediaSource audioSource = new ProgressiveMediaSource(Uri.parse("url"),
// new CacheDataSourceFactory(this, 100 * 1024 * 1024, 5 * 1024 * 1024), new DefaultExtractorsFactory(), null, null);