stability fix at main screen
This commit is contained in:
parent
15cfe7730d
commit
59552f0ebb
2 changed files with 19 additions and 19 deletions
|
@ -26,6 +26,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
SQLiteDatabase db;
|
||||
ArrayList Name;
|
||||
ArrayList Img;
|
||||
MyDbHelper dbHelper;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -38,29 +39,28 @@ public class MainActivity extends AppCompatActivity {
|
|||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getApplicationContext());
|
||||
recyclerView.setLayoutManager(linearLayoutManager);
|
||||
|
||||
MyDbHelper dbHelper = new MyDbHelper(this);
|
||||
db = dbHelper.getWritableDatabase();
|
||||
if (db != null) {
|
||||
// Database Queries
|
||||
Name = new ArrayList<String>();
|
||||
Img = new ArrayList<String>();
|
||||
String query = "SELECT id FROM account";
|
||||
Cursor cursor = db.rawQuery(query,null);
|
||||
while (cursor.moveToNext()){
|
||||
Name.add(cursor.getString(0));
|
||||
Img.add(R.drawable.account);
|
||||
}
|
||||
db.close();
|
||||
} else {
|
||||
Toast.makeText(getApplicationContext(),getResources().getString(R.string.broken_database), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
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
|
||||
Name = new ArrayList<String>();
|
||||
Img = new ArrayList<String>();
|
||||
String query = "SELECT id FROM account";
|
||||
Cursor cursor = db.rawQuery(query,null);
|
||||
while (cursor.moveToNext()){
|
||||
Name.add(cursor.getString(0));
|
||||
Img.add(R.drawable.account);
|
||||
}
|
||||
db.close();
|
||||
} else {
|
||||
Toast.makeText(getApplicationContext(),getResources().getString(R.string.broken_database), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
runOnUiThread(new Runnable() {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue