android中Window.LayoutParams.FLAG_FULLSCREEN

android中Window.LayoutParams.FLAG_FULLSCREEN
是父类.子类.常量吗
如果是的话,
这是特定方法的参数对象吗
如果是的话,为什么不直接写FLAG_FULLSCREEN
更简洁明了呢

2个回答

WindowManager.LayoutParams 是 WindowManager 接口的嵌套类
FLAG_FULLSCREEN是其中的一个常量

为什么不直接写FLAG_FULLSCREEN
因为类库中这种常量多如牛毛,如果堆在一起,不但不方便记忆和组织,而且搞不好还会重复冲突。

内部类而已,里面定义了一些常量。也是便于区分

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Android中Toast不能显示的问题

我想展示一个toast消息, 但不知为什么它总是不能被调用时,以下是我的oncreate代码: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.requestWindowFeature(Window.FEATURE_NO_TITLE); this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.alarm); mediaPlayer = MediaPlayer.create(getApplicationContext(), R.raw.alarmclock); mediaPlayer.start(); Toast.makeText(this, "Alarm time up", Toast.LENGTH_LONG); }

cocos2d-Android游戏开发,场景的切换

请看下面的代码,我从start场景切换到main场景时,为什么main场景里的动画实现不了啊,求大虾帮帮忙,谢谢! package com.example.leidiandazhan; import org.cocos2d.layers.CCScene; import org.cocos2d.nodes.CCDirector; import org.cocos2d.opengl.CCGLSurfaceView; import android.app.Activity; import android.os.Bundle; import android.view.Window; import android.view.WindowManager; public class MainActivity extends Activity { private CCGLSurfaceView view; private CCDirector director = CCDirector.sharedDirector(); private CCScene scene = CCScene.node(); private StartLayer start; private MainLayer main; private EndLayer end; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.requestWindowFeature(Window.FEATURE_NO_TITLE); this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); this.getWindow().setFlags( WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); view = new CCGLSurfaceView(this); setContentView(view); director.attachInView(view); director.setScreenSize(320, 480); director.setDisplayFPS(true); director.setAnimationInterval(1 / 30); start = new StartLayer(this); scene.addChild(start); director.runWithScene(scene); } public void toMainLayer() { main = new MainLayer(this); scene.addChild(main); director.replaceScene(scene); start.removeAllChildren(true); } public void toEndLayer() { end = new EndLayer(this); scene.addChild(end); director.replaceScene(scene); } }

关于安卓隐藏标题栏的问题

各位大侠,试过很多百度的方法,状态栏倒是可以隐藏,可是这标题栏隐藏不了,单独在Activity加上this.requestWindowFeature(Window.FEATURE_NO_TITLE);也不行,就是下面图片的蓝色部分:![图片说明](https://img-ask.csdn.net/upload/201608/23/1471923057_307396.jpg)

Android 横屏设置, 为什么会先显示一会竖屏?

Actiivty 横屏设置, 为什么会先显示一会竖屏? ``` var TAG = "Test" override fun onCreate(savedInstanceState: Bundle?) { setOrientation() super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) Log.d(TAG, "onCreate") } private fun setOrientation() { //隐藏标题 requestWindowFeature(Window.FEATURE_NO_TITLE); //设置全屏 window.setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN ) requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE } ``` 为什么会先出来一会的竖屏, 才会横屏显示 ? 但是在 AndroidManifest.xml 中设置 ``` <activity android:name=".EmptyActivity" android:configChanges="orientation|keyboardHidden|navigation" android:screenOrientation="landscape"/> ``` 就能正常横屏显示....

音乐播放器 路径设置错误 。。求帮忙

package com.example.administrator.musicplayer; import android.annotation.TargetApi; import android.app.Activity; import android.graphics.Color; import android.media.MediaPlayer; import android.os.Build; import android.os.Bundle; import android.os.Environment; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.AdapterView; import android.widget.Button; import android.widget.ListView; import java.io.File; import java.io.FileFilter; import java.io.IOException; import java.util.ArrayList; import java.util.List; public class MainActivity extends Activity { private ListView listView; private MusicList_Adapter adapter_musicList; private List<String> list; String MUSIC_PATH = String.valueOf(Environment.getExternalStorageDirectory()); private Button button; MediaPlayer mediaPlayer = new MediaPlayer(); @TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); MainActivity.this.requestWindowFeature(Window.FEATURE_NO_TITLE); Window window = getWindow(); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.setStatusBarColor(Color.parseColor("#87CEEB")); setContentView(R.layout.activity_main); button = (Button) findViewById(R.id.start); System.out.println(Environment.getExternalStorageDirectory()); listView = (ListView) findViewById(R.id.music_list); list = new ArrayList<>(); musiclist(); adapter_musicList = new MusicList_Adapter(this, list); listView.setAdapter(adapter_musicList); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { playmusic(MUSIC_PATH + list.get(position)); } }); } private void playmusic(String path) { try { mediaPlayer.reset(); mediaPlayer.setDataSource(path); mediaPlayer.prepare(); mediaPlayer.start(); } catch (IOException e) { e.printStackTrace(); } } private void musiclist() { File music = new File(MUSIC_PATH); if (music.listFiles(new MusicFilter()).length > 0) { for (File file : music.listFiles(new MusicFilter())) { list.add(file.getName()); } } } } ``` ``` 上面是全部代码 SD卡的读写权限也都加上了 然后点列表的时候就报错 java.io.IOException: setDataSource failed. 求解决。。。

从spinner中开始新的activity

需要实现的功能是spinner中一个选项可以开始一个新的activity。但是应用每次执行到这都会崩溃。我用了intent和onItemSelected 。不知道哪里出现的问题,请高手指教,谢谢。 import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.AdapterView; import android.widget.AdapterView.OnItemSelectedListener; import android.widget.Spinner; import android.widget.TextView; public class Abs extends Activity { private Spinner StretchType; TextView tv; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags( WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN, WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); setContentView(R.layout.abs); addListenerOnSpinnerItemSelection(); tv = (TextView) findViewById(R.id.tvTypeofStretch); } public void addListenerOnSpinnerItemSelection() { StretchType = (Spinner) findViewById(R.id.sSType); StretchType .setOnItemSelectedListener(new CustomOnItemSelectedListener()); } public class CustomOnItemSelectedListener extends Activity implements OnItemSelectedListener { public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) { // **************************** below here is where I start the new activity switch (pos) { case (1): Intent i = new Intent(this, Practice.class); startActivity(i); break; } // **************************** above here is where I start the new activity } @Override public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub } } }

android这段代码为什么无限启动相机?应该怎么改?

package nzy.ssp; import java.io.File; import nzy.ssp.net.AuthSina.common.InfoHelper; import android.app.Activity; import android.content.Intent; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.provider.MediaStore; import android.util.Log; import android.view.Window; import android.view.WindowManager; import android.widget.Toast; //定义一个类,使其实现拍照并保存功能 public class ActivityTakePic extends Activity { // 定义类的成员变量 private int TAKE_PICTURE = 1; private String TAG = "ActivityTakePic"; public static String thisLarge = null; private String theSmall = null; public static Uri photoUri; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //设置全屏 requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); //setContentView(R.layout.main); Toast.makeText(this, "启动拍照功能……", Toast.LENGTH_SHORT).show(); // 手机拍照 opentakePicDialog(); } private boolean checkSdCard() { if (android.os.Environment.getExternalStorageDirectory().equals( android.os.Environment.MEDIA_MOUNTED)) { return true; } else { return false; } } // 拍照 private void opentakePicDialog() { if (!checkSdCard()) { Intent intent = new Intent("android.media.action.IMAGE_CAPTURE"); startActivityForResult(intent, TAKE_PICTURE); } else { Toast.makeText(ActivityTakePic.this, "你手机上不存在存储卡", Toast.LENGTH_LONG).show(); } } /* * 相机拍照回调函数 * * @see android.app.Activity#onActivityResult(int, int, * android.content.Intent) */ @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == TAKE_PICTURE) { if (resultCode == RESULT_OK) { // super.onActivityResult(requestCode, resultCode, data); Log.i(TAG, TAG); Intent intent = new Intent(); String camerName = InfoHelper.getFileName(); Log.i(TAG, "camerName = " + camerName); String fileName = "Share" + camerName + ".jpg"; File camerFile = new File(InfoHelper.getCamerPath(), fileName); theSmall = InfoHelper.getCamerPath() + fileName; thisLarge = getLatestImage(); Log.i(TAG, "theSmall = " + theSmall); Log.i(TAG, "thisLarge = " + thisLarge); photoUri = Uri.fromFile(camerFile); data.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, photoUri); intent.putExtras(data); intent.putExtra("int", 0); intent.setClass(ActivityTakePic.this, ActivityMain.class); startActivity(intent); } } } /** * 获取SD卡中最新图片路径 * * @return */ @SuppressWarnings("unused") protected String getLatestImage() { String latestImage = null; String[] items = { MediaStore.Images.Media._ID, MediaStore.Images.Media.DATA }; Cursor cursor = managedQuery( MediaStore.Images.Media.EXTERNAL_CONTENT_URI, items, null, null, MediaStore.Images.Media._ID + " desc"); if (cursor != null && cursor.getCount() > 0) { cursor.moveToFirst(); for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) { latestImage = cursor.getString(1); break; } } return latestImage; } }

关于mediaplay遇到一些问题,急求

代码如下 package org.lxh.demo; import java.io.IOException; import android.app.Activity; import android.content.Intent; import android.media.AudioManager; import android.media.MediaPlayer; import android.os.Bundle; import android.view.KeyEvent; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.View; import android.view.View.OnClickListener; import android.view.Window; import android.view.WindowManager; import android.widget.ImageButton; public class PlayVideoActivity extends Activity { private ImageButton play = null; private ImageButton stop = null; private ImageButton back = null; private MediaPlayer media = null; private SurfaceView sufaceView = null; private SurfaceHolder surfaceHolder = null; private String filepath = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.requestWindowFeature(Window.FEATURE_NO_TITLE); // 不显示标题 super.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); super.getWindow().addFlags( WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); // 高亮的风格显示 super.setContentView(R.layout.play); this.filepath = super.getIntent().getStringExtra("filepath") ; this.play = (ImageButton) super.findViewById(R.id.play); this.stop = (ImageButton) super.findViewById(R.id.stop); this.back = (ImageButton) super.findViewById(R.id.back); this.sufaceView = (SurfaceView) super.findViewById(R.id.surfaceView) ; this.surfaceHolder = this.sufaceView.getHolder() ; this.surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS) ; this.media =new MediaPlayer() ; this.media.reset() ; try { this.media.setDataSource(this.filepath) ; } catch (Exception e) { } this.play.setOnClickListener(new PlayOnClickListenerImpl()); this.stop.setOnClickListener(new StopOnClickListenerImpl()); this.back.setOnClickListener(new BackOnClickListenerImpl()); } private class PlayOnClickListenerImpl implements OnClickListener { @Override public void onClick(View v) { PlayVideoActivity.this.media.setAudioStreamType(AudioManager.STREAM_MUSIC) ; PlayVideoActivity.this.media.setDisplay(PlayVideoActivity.this.surfaceHolder) ; try { PlayVideoActivity.this.media.prepare() ; PlayVideoActivity.this.media.start() ; } catch (Exception e) { } } } private class StopOnClickListenerImpl implements OnClickListener { @Override public void onClick(View v) { PlayVideoActivity.this.media.stop() ; } } private class BackOnClickListenerImpl implements OnClickListener { @Override public void onClick(View v) { Intent it = new Intent(PlayVideoActivity.this, BroswerActivity.class); PlayVideoActivity.this.startActivity(it); } } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if(keyCode == KeyEvent.KEYCODE_BACK) { this.media.stop() ; this.media.release() ; super.finish() ; } return false ; } } 编译的时候报错为 ![图片说明](https://img-ask.csdn.net/upload/201704/19/1492592903_728846.png)

android如何取消titlebar并全屏

开发工具是android stdio,请看清楚再回答,eclipse直接在xml中设置theme但是android stdio并没有这个theme,在activity中添加 requestWindowFeature(Window.FEATURE_LEFT_ICON); getWindow().setFlags(WindowManager.LayoutParams. FLAG_FULLSCREEN , WindowManager.LayoutParams. FLAG_FULLSCREEN); 也无法实现去除title

android 自定义camera 自动拍照

可以自动拍照的是魅族android版本5.01,不能自动拍照的是android版本5.1。是系统问题吗? 自动拍照功能在一些手机上可以使用,一些不能用。求原因 。坐等答案。 ``` public class CameraActivity extends Activity { private CameraView view; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().clearFlags( WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN); requestWindowFeature(Window.FEATURE_NO_TITLE);// 设置横屏模式以及全屏模式 view = new CameraView(this);// 通过一个surfaceview的view来实现拍照 view.setId(1); view = new CameraView(this, this); setContentView(R.layout.camera_layout); RelativeLayout relative = (RelativeLayout) this.findViewById(R.id.ly); RelativeLayout.LayoutParams Layout = new RelativeLayout.LayoutParams(3, 3);// 设置surfaceview使其满足需求无法观看预览 Layout.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 1); Layout.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 1); relative.addView(view, Layout); } } (2) CameraView.java package com.camera.test; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; import android.app.Activity; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Point; import android.graphics.PointF; import android.hardware.Camera; import android.hardware.Camera.AutoFocusCallback; import android.hardware.Camera.ShutterCallback; import android.media.AudioManager; import android.media.FaceDetector; import android.media.FaceDetector.Face; import android.os.Environment; import android.os.Handler; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.widget.Toast; public class CameraView extends SurfaceView implements SurfaceHolder.Callback, Camera.PictureCallback { private SurfaceHolder holder; private Camera camera; private Camera.Parameters parameters; private Activity act; private Handler handler = new Handler(); private Context context; private SurfaceView surfaceView; private AudioManager audio; private int current; public CameraView(Context context) { super(context); surfaceView = this; audio = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); final int current = audio.getRingerMode(); audio.setRingerMode(AudioManager.RINGER_MODE_SILENT); this.context = context; holder = getHolder();// 生成Surface Holder holder.addCallback(this); holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);// 指定Push Buffer handler.postDelayed(new Runnable() { @Override public void run() { if (camera == null) { handler.postDelayed(this, 1 * 1000);// 由于启动camera需要时间,在此让其等两秒再进行聚焦知道camera不为空 } else { camera.autoFocus(new AutoFocusCallback() { @Override public void onAutoFocus(boolean success, Camera camera) { if (success) { camera.takePicture(new ShutterCallback() {// 如果聚焦成功则进行拍照 @Override public void onShutter() { } }, null, CameraView.this); } else { } } }); } } }, 2 * 1000); } public CameraView(Context context, Activity act) {// 在此定义一个构造方法用于拍照过后把CameraActivity给finish掉 this(context); this.act = act; } @Override public void surfaceCreated(final SurfaceHolder holder) { // TODO Auto-generated method stub camera = Camera.open();// 摄像头的初始化 handler.postDelayed(new Runnable() { @Override public void run() { if (holder != null) { try { camera.setPreviewDisplay(holder); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { handler.postDelayed(this, 1 * 1000); } } }, 2 * 1000); } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { // TODO Auto-generated method stub parameters = camera.getParameters(); camera.setParameters(parameters);// 设置参数 camera.startPreview();// 开始预览 } @Override public void surfaceDestroyed(SurfaceHolder holder) { // TODO Auto-generated method stub } public void onPictureTaken(byte[] data, Camera camera) {// 拍摄完成后保存照片 try { Date date = new Date(); SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss"); String time = format.format(date); //在SD卡上创建文件夹 File file = new File(Environment.getExternalStorageDirectory() + "/myCamera/pic"); if (!file.exists()) { file.mkdirs(); } String path = Environment.getExternalStorageDirectory() + "/myCamera/pic/" + time + ".jpg"; data2file(data, path); camera.setPreviewCallback(null); camera.stopPreview(); camera.release(); camera = null; holder.removeCallback(CameraView.this); audio.setRingerMode(current); act.finish(); //uploadFile(path); } catch (Exception e) { } } private void data2file(byte[] w, String fileName) throws Exception {// 将二进制数据转换为文件的函数 FileOutputStream out = null; try { out = new FileOutputStream(fileName); out.write(w); out.close(); } catch (Exception e) { if (out != null) out.close(); throw e; } } // private void uploadFile(String filePath)// 拍照过后上传文件到服务器 // { // } } ```

android 程序进入后台以后,过一段时间再点进去报错,黑屏。

## _**下面是写的异常日志抓取的报错代码:**_ android.util.SuperNotCalledException: Activity {com.st.sliding/com.st.sliding.MainActivity} did not call through to super.onCreate() at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2418) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2524) at android.app.ActivityThread.access$800(ActivityThread.java:167) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1419) at android.os.Handler.dispatchMessage(Handler.java:111) at android.os.Looper.loop(Looper.java:194) at android.app.ActivityThread.main(ActivityThread.java:5546) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:964) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:759) ## _上面说我的onCreate为空,但是我有super.onCreate(savedInstanceState);这句代码的,主要原因是因为后台再点进来没有数据了,所以为空???不知道怎么解决了 ## 请教大指点指点~ ## ## 这是我的代码:_ public class MainActivity extends SlidingActivity { private SlidingActivityHelper mHelper; TodayFragment today; GroupFragment groupFragment; AdviceFragment adviceFragment; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // 去掉标题栏 // this.requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.layout_main); // this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, // WindowManager.LayoutParams.FLAG_FULLSCREEN); // set the Behind View setBehindContentView(R.layout.frame_menu); FragmentTransaction fragmentTransaction = getFragmentManager() .beginTransaction(); LeftMenuFragment menuFragment = new LeftMenuFragment(); fragmentTransaction.replace(R.id.menu, menuFragment); fragmentTransaction.commit(); initSlidingMenu(); // //提示跳转 // showProgressDialog("提示", "正在跳转,请稍后......"); // } private void initSlidingMenu() { // 如果保存的状态不为空则得到之前保存的Fragment,否则实例化MyFragment // if (savedInstanceState != null) { // mContent = getSupportFragmentManager().getFragment( // savedInstanceState, "mContent"); // } // // if (mContent == null) { // mContent = new TodayFragment(); // } // customize the SlidingMenu SlidingMenu sm = getSlidingMenu(); sm.setShadowWidth(50); sm.setShadowDrawable(R.drawable.shadow); sm.setBehindOffset(180);// 设置slindingmenu的宽度 sm.setFadeDegree(0.35f); sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN); getActionBar().setDisplayHomeAsUpEnabled(true); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.activity_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: toggle(); break; } return super.onOptionsItemSelected(item); } private long exitTime = 0; @Override public void onBackPressed() { if (System.currentTimeMillis() - exitTime > 2000) { Toast.makeText(this, "再按一次退出程序", Toast.LENGTH_SHORT).show(); exitTime = System.currentTimeMillis(); } else { finish(); System.exit(0); android.os.Process.killProcess(android.os.Process.myPid()); } } }

给所有的Activity设置全屏幕布局

我想做一个适合所有的智能手机的全屏幕视图。使用这段代码创建一个可以水平和垂直滚动的表格布局tablelayout。同时我也想查看集中在布局中编辑框edittext的模型。如何给所有的Activity设置全屏幕布局?谢谢。 public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.seconda); HorizontalScrollView HSC = new HorizontalScrollView(this); ScrollView VSC = new ScrollView(this); VSC.setBackgroundResource(R.drawable.lavagna_psd); tableLayout = new TableLayout(this); tableLayout.setGravity(Gravity.CENTER); values = new EditText[3][3]; for (int i = 0; i < 3; i++) { tableRow = new TableRow(this); tableRow.setGravity(Gravity.CENTER); for (int j = 0; j < 3 ; j++) { values[i][j] = new EditText(this); values[i][j].setHint("r: " + (i) + " " + "c: " + (j)); values[i][j].setPadding(10, 10, 10, 10); tableRow.addView(values[i][j]); } tableLayout.addView(tableRow); } VSC.addView(tableLayout); HSC.addView(VSC); setContentView(HSC); }

点击完AdMob的广告条按下返回键时游戏没回应。!?

玩player上别人的app点击完广告后按下手机back键,游戏还好好的在等你回来继续...我的app却是按完广告返回游戏时已经没有回应...是不是少写了什么.... //-----Activity package asue.game; import android.os.Bundle; import android.app.Activity; import android.view.Window; import android.view.WindowManager; import android.content.pm.ActivityInfo; import android.util.DisplayMetrics; public class MainActivity extends Activity { public static float vWidth; public static float vHeight; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); :( :( getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.main); DisplayMetrics dm = new DisplayMetrics(); this.getWindowManager().getDefaultDisplay().getMetrics(dm); //取得裝置的資訊 vWidth = dm.widthPixels;//寬 vHeight = dm.heightPixels; //高 } /** Called before the activity is destroyed. */ @Override public void onDestroy() { super.onDestroy(); } } //-------------main <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" android:layout_width="match_parent" android:layout_height="match_parent"> <asue.game.Panel android:id="@+id/mainPanel" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@+id/adView" android:layout_gravity="top" android:layout_alignParentTop="true" /> <com.google.ads.AdView android:id="@id/adView" android:layout_width="match_parent" android:layout_height="wrap_content" ads:adSize="BANNER" ads:adUnitId="a1234567890" ads:loadAdOnCreate="true" android:layout_alignParentBottom="true" /> </RelativeLayout>

Android直接跳转activity报错

每次运行总是报错,能进入软件,但跳转时报错 ``` package com.text.Mark1; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.view.Window; import android.view.WindowManager; public class welcome extends Activity{ @Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉标题栏 getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);//全屏显示 setContentView(R.layout.welcome2); new Handler().postDelayed(new Runnable(){ @Override public void run(){ Intent intent = new Intent (welcome.this,login.class); startActivity(intent); welcome.this.finish(); } }, 1000); } } ``` 12-26 09:09:33.025: E/AndroidRuntime(555): FATAL EXCEPTION: main 12-26 09:09:33.025: E/AndroidRuntime(555): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.text.Mark1/com.text.Mark1.login}; have you declared this activity in your AndroidManifest.xml? 12-26 09:09:33.025: E/AndroidRuntime(555): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1508) 12-26 09:09:33.025: E/AndroidRuntime(555): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1384) 12-26 09:09:33.025: E/AndroidRuntime(555): at android.app.Activity.startActivityForResult(Activity.java:3190) 12-26 09:09:33.025: E/AndroidRuntime(555): at android.app.Activity.startActivity(Activity.java:3297) 12-26 09:09:33.025: E/AndroidRuntime(555): at com.text.Mark1.welcome$1.run(welcome.java:25) 12-26 09:09:33.025: E/AndroidRuntime(555): at android.os.Handler.handleCallback(Handler.java:605) 12-26 09:09:33.025: E/AndroidRuntime(555): at android.os.Handler.dispatchMessage(Handler.java:92) 12-26 09:09:33.025: E/AndroidRuntime(555): at android.os.Looper.loop(Looper.java:137) 12-26 09:09:33.025: E/AndroidRuntime(555): at android.app.ActivityThread.main(ActivityThread.java:4340) 12-26 09:09:33.025: E/AndroidRuntime(555): at java.lang.reflect.Method.invokeNative(Native Method) 12-26 09:09:33.025: E/AndroidRuntime(555): at java.lang.reflect.Method.invoke(Method.java:511) 12-26 09:09:33.025: E/AndroidRuntime(555): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 12-26 09:09:33.025: E/AndroidRuntime(555): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 12-26 09:09:33.025: E/AndroidRuntime(555): at dalvik.system.NativeStart.main(Native Method)

给所有的activity设置全屏布局

我想做出一个适合所有智能手机的全屏模式。下面这段代码创建一个tablelayout布局,可以水平和垂直滚动。同时想把 edittext矩阵集放在布局的中间位置。怎么实现这个功能? public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.seconda); HorizontalScrollView HSC = new HorizontalScrollView(this); ScrollView VSC = new ScrollView(this); VSC.setBackgroundResource(R.drawable.lavagna_psd); tableLayout = new TableLayout(this); tableLayout.setGravity(Gravity.CENTER); values = new EditText[3][3]; for (int i = 0; i < 3; i++) { tableRow = new TableRow(this); tableRow.setGravity(Gravity.CENTER); for (int j = 0; j < 3 ; j++) { values[i][j] = new EditText(this); values[i][j].setHint("r: " + (i) + " " + "c: " + (j)); values[i][j].setPadding(10, 10, 10, 10); tableRow.addView(values[i][j]); } tableLayout.addView(tableRow); } VSC.addView(tableLayout); HSC.addView(VSC); setContentView(HSC); }

android webview加载服务器上js自动轮播图片不显示问题,求大神帮忙

这个是手机版网站地址:m.daxuepai.com.cn 正常打开首页应该有轮播图片,如下图: ![图片说明](https://img-ask.csdn.net/upload/201601/20/1453302838_761230.png) 轮播功能是做web前端的人用js写的。 以下是我android中的代码,主要就是用webview加载了相应地址的资源,但是我加载了后那个轮播图就没有显示,代码如下: package com.example.testwebkit; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.Window; import android.view.WindowManager; import android.webkit.WebChromeClient; import android.webkit.WebSettings.ZoomDensity; import android.webkit.WebView; import android.webkit.WebViewClient; public class MainActivity extends Activity { private WebView webView; @SuppressWarnings("deprecation") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); int flag=WindowManager.LayoutParams.FLAG_FULLSCREEN; //获得当前窗体对象 Window window=MainActivity.this.getWindow(); //设置当前窗体为全屏显示 window.setFlags(flag, flag); setContentView(R.layout.activity_main); webView = (WebView) findViewById(R.id.webView1); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setDomStorageEnabled(true); webView.loadUrl("http://m.daxuepai.com.cn"); webView.setWebChromeClient(new WebChromeClient(){ @Override public void onReceivedTitle(WebView view, String title) { // TODO Auto-generated method stub super.onReceivedTitle(view, title); } }); webView.setWebViewClient(new WebViewClient(){ @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { // TODO Auto-generated method stub view.loadUrl(url); return super.shouldOverrideUrlLoading(view, url); } }); } } 打开后效果如下: ![图片说明](https://img-ask.csdn.net/upload/201601/20/1453303268_724677.png) 我用的是MX3,手机自带浏览器、手机版猎豹浏览器同样不加载轮播图片,手机qq浏览器、微信关注公众号后进首页都可以加载那个轮播图片,有大神能告诉我是为什么么? ``` ```

安卓音乐播放器 路径设置错误? 求帮忙看一下。。。

public class MainActivity extends Activity implements AdapterView.OnItemClickListener { private MediaPlayer mediaPlayer; private List<String> musicList; private int Index = -1; private String MUSIC_PATH = new String("/storage/emulated/0/kgmusic/download"); ListView listView; @TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_NO_TITLE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window window = getWindow(); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.setStatusBarColor(Color.TRANSPARENT); } setContentView(R.layout.activity_main); mediaPlayer = new MediaPlayer(); System.out.println(Environment.getExternalStorageDirectory().toString()); findView(); musiclist(); start(); stop(); pause(); lastmusic(); nextMusic(); listView.setOnItemClickListener(this); Log.e("KeyEvent", "KEYCODE_BACK"); // seekbar(); } //获取按钮 void findView() { viewHolder.start = (Button) findViewById(R.id.start); viewHolder.stop = (Button) findViewById(R.id.stop); viewHolder.next = (Button) findViewById(R.id.next); viewHolder.pause = (Button) findViewById(R.id.pause); viewHolder.last = (Button) findViewById(R.id.last); listView = (ListView) findViewById(R.id.android_list); viewHolder.seekBar = (SeekBar) findViewById(R.id.seekbar); viewHolder.current_time = (TextView) findViewById(R.id.current_time); viewHolder.total_time = (TextView) findViewById(R.id.total_time); } private void musiclist() { musicList = new ArrayList<>(); File musicfile = new File(MUSIC_PATH); if (musicfile.listFiles(new MusicFilter()).length >= 0) { for (File file : musicfile.listFiles(new MusicFilter())) { musicList.add(file.getName().replace(".mp3","")); } ListAdapter listAdapter = new jukeboxv2.bmvod.net.testplayer.ListAdapter(this,musicList); listView.setAdapter(listAdapter); } } private void playmusic(String path) { try { mediaPlayer.reset(); mediaPlayer.setDataSource(path); mediaPlayer.prepare(); mediaPlayer.start(); } catch (IOException e) { e.printStackTrace(); } mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mp) { nextMusic(); } }); } private void stop() { viewHolder.stop.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mediaPlayer.isPlaying()) { mediaPlayer.stop(); } } }); } private void start() { viewHolder.start.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { playmusic(MUSIC_PATH + musicList.get(Index)); } }); } private void pause() { viewHolder.pause.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mediaPlayer.isPlaying()) { mediaPlayer.pause(); } else { mediaPlayer.start(); } } }); } private void lastmusic() { viewHolder.last.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (Index != 0) { if (--Index >= 0) { Index = musicList.size(); } else { playmusic(MUSIC_PATH + musicList.get(Index)); } } else { playmusic(MUSIC_PATH + musicList.get(Index)); } } }); } private void nextMusic() { viewHolder.next.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (++Index > musicList.size()) { Index = 0; } else { playmusic(MUSIC_PATH + musicList.get(Index)); } } }); } private void seekbar() { int progress = viewHolder.seekBar.getProgress(); int musicmaxlength = mediaPlayer.getDuration(); int seekbarmax = viewHolder.seekBar.getMax(); mediaPlayer.seekTo(musicmaxlength * progress / seekbarmax); } @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); } @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) {//med Index = position; playmusic(MUSIC_PATH + musicList.get(Index)); } ``` ``` java.io.IOException: setDataSource failed. 错误 请问是什么原因呢?

OpenGL 纹理映射无法显示纹理

初学者,希望大侠们能做个解答,小弟在此先行谢过,问题很简单,但我琢磨好久都没搞出来,也找不出问题所在。 想要实现的的功能也很简单,就是纹理。 问题所在:运行之后只有背景,没有纹理 开发环境:Eclipse ADT 源代码: 一、SRC/ SFGame.java package com.gamewenli; import android.app.Activity; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.opengl.GLSurfaceView; import android.opengl.GLSurfaceView.Renderer; import android.os.Bundle; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.Button; public class SFGame extends Activity { Renderer render = new SFBameRenderer(this); GLSurfaceView gameView; Button start; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); GLImage.load(this.getResources()); gameView = new GLSurfaceView(this); gameView.setRenderer(render); setContentView(R.layout.pageone); start = (Button) findViewById(R.id.button1); start.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setContentView(gameView); } }); 二、 SRC/SFBameRenderer.java package com.gamewenli; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.opengles.GL10; import android.content.Context; import android.opengl.GLSurfaceView.Renderer; import android.opengl.GLUtils; public class SFBameRenderer implements Renderer { public Context context; private int[] textureids; private FloatBuffer vertexBuffer; private FloatBuffer textureBuffer; //private ByteBuffer indexBuffer; //vertices[]数组会列出一系列的点,其中每一行代表正方形一角的X,Y,Z的值. private float vertices[] ={ 0f, 0f, 0f, 1f, 0f, 0f, 1f, 1f, 0f, 0f, 1f, 0f, }; //texture[]数组表示纹理的四角在何处能与所创建的正方形四角排成一条直线 private float texture[] = { 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f }; //indices[]数组表示正方形表面的定义,正方形的表面被划分为两个三角形,该数组就是逆时针方向上这些三角形的角度数。 //private byte indices[] = { //0, 1, 2, //0, 2, 3 //}; public SFBameRenderer(Context context) { this.context = context; textureids = new int[1]; ByteBuffer vbb = ByteBuffer.allocateDirect(vertices.length * 4); vbb.order(ByteOrder.nativeOrder()); vertexBuffer = vbb.asFloatBuffer(); vertexBuffer.put(vertices); vertexBuffer.position(0); ByteBuffer tbb = ByteBuffer.allocateDirect(texture.length * 4); tbb.order(ByteOrder.nativeOrder()); textureBuffer = tbb.asFloatBuffer(); //indexBuffer = ByteBuffer.allocateDirect(indices.length); //indexBuffer.put(indices); //indexBuffer.position(0); //为正方形贴上纹理 //for (int i = 0; i < 1; i++) { textureBuffer.put(texture); //} textureBuffer.position(0); } @Override public void onDrawFrame(GL10 gl) { // 清除屏幕和深度缓存 gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); // 重置当前的模型观察矩阵 gl.glLoadIdentity(); // 开启顶点和纹理功能(开启顶点和纹理缓冲) gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); // 设置顶点和纹理 gl.glVertexPointer(3, GL10.GL_FIXED, 0, vertexBuffer); gl.glTexCoordPointer(3, GL10.GL_FIXED, 0, textureBuffer); // 绘制正方形 //int i = 1; //switch (i) { //case 0: // 生成纹理 GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, GLImage.iBitmap, 0); // 关闭顶点和纹理功能 gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY); gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); } //} @Override public void onSurfaceChanged(GL10 gl, int width, int height) { float ratio = (float) (width) / height; // 设置OpenGL场景的大小 gl.glViewport(0, 0, width, height); // 设置投影矩阵 gl.glMatrixMode(GL10.GL_PROJECTION); // 重置投影矩阵 gl.glLoadIdentity(); // 设置视口的大小 gl.glFrustumf(-ratio, ratio, -1, 1, 1, 10); // 选择模型观察矩阵 gl.glMatrixMode(GL10.GL_MODELVIEW); // 重置模型观察矩阵 gl.glLoadIdentity(); } @Override public void onSurfaceCreated(GL10 gl, EGLConfig config) { // 告诉系统对透视进行修正 gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_FASTEST); // 绿色背景 gl.glClearColor(0, 1, 0, 0); gl.glEnable(GL10.GL_CULL_FACE); // 启用阴影平滑 gl.glShadeModel(GL10.GL_SMOOTH); // 启用深度测试 gl.glEnable(GL10.GL_DEPTH_TEST); //启用纹理映射 gl.glClearDepthf(1.0f); //深度测试的类型 gl.glDepthFunc(GL10.GL_LEQUAL); // 允许2D贴图,纹理 gl.glEnable(GL10.GL_TEXTURE_2D); gl.glEnable(GL10.GL_BLEND); gl.glBlendFunc(GL10.GL_ONE, GL10.GL_ONE); // 创建纹理 gl.glGenTextures(1, textureids, 0); // 绑定要使用的纹理 gl.glBindTexture(GL10.GL_TEXTURE_2D, textureids[0]); GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, GLImage.iBitmap, 0); // 线性滤波 gl.glTexParameterx(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR); gl.glTexParameterx(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR); } } } } class GLImage { public static Bitmap iBitmap; public static Bitmap close_Bitmap; public static void load(Resources resources) { iBitmap = BitmapFactory.decodeResource(resources, R.drawable.wall); } } 三、 RES/Androidmanifest.xml <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.gamewenli" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19" /> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name="SFGame"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>

Android Spinner选择的项目未显示

<div class="post-text" itemprop="text"> <p>i got the items from the database</p> <p>Here's the java code</p> <pre><code>package com.example.androidtablayout; public class Leave extends Activity implements OnItemSelectedListener{ Button btnSubmitLeave,btnLogout; SessionManager session; JSONParser jsonParser = new JSONParser(); Spinner mySpinner; ProgressDialog mProgressDialog; JSONArray jsonarray; ArrayList&lt;String&gt; leavetype; String username; EditText inputStart,inputEnd,inputReason; final Calendar myCalendar = Calendar.getInstance(); private String url_leavetype = "http://10.0.3.2/sunshine-ems/get_leavetype.php"; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.leave); // CHECK TO LOGIN SESSION session = new SessionManager(getApplicationContext()); session.checkLogin(); username = session.getUsername(); inputReason = (EditText) findViewById(R.id.inputReason); inputStart = (EditText) findViewById(R.id.inputStart); inputEnd = (EditText) findViewById(R.id.inputEnd); btnSubmitLeave = (Button) findViewById(R.id.btnSubmitLeave); //spinner mySpinner= (Spinner) findViewById(R.id.spinnerLeaveType); leavetype = new ArrayList&lt;String&gt;(); ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this,android.R.layout.simple_spinner_item, leavetype); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); new getLeaveTypes().execute(); mySpinner.setAdapter(adapter); mySpinner.setOnItemSelectedListener(this); } private class getLeaveTypes extends AsyncTask&lt;String, String, String&gt; { @Override protected void onPreExecute() { super.onPreExecute(); mProgressDialog = new ProgressDialog(Leave.this); mProgressDialog.setTitle("Getting Leave types"); mProgressDialog.setMessage("Loading..."); mProgressDialog.setIndeterminate(false); mProgressDialog.show(); } @Override protected String doInBackground(String... args) { int success; List&lt;NameValuePair&gt; params1 = new ArrayList&lt;NameValuePair&gt;(); try { params1.add(new BasicNameValuePair("username", username)); JSONObject json = jsonParser.makeHttpRequest(url_leavetype, "GET",params1); // full json response Log.d("Get Leave types", json.toString()); // json success element success = json.getInt(TAG_SUCCESS); if (success == 1) { JSONArray type = json.getJSONArray("leavetypes"); for (int i = 0; i &lt; type.length(); i++) { JSONObject catObj = (JSONObject) type.get(i); leavetype.add(catObj.optString("leave_name")); } } else { Log.d("Login Failure!", json.getString(TAG_MESSAGE)); return json.getString(TAG_MESSAGE); } } catch (JSONException e) { e.printStackTrace(); } return null; } protected void onPostExecute(String file_url) { // dismiss the dialog once product deleted mProgressDialog.dismiss(); } } public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int position, long id) { Toast.makeText( getApplicationContext(), parent.getItemAtPosition(position).toString() + " Selected" , Toast.LENGTH_LONG).show(); } public void onNothingSelected(AdapterView&lt;?&gt; arg0) { } } </code></pre> <p>That data from the database is there, the spinner list is showing, but when i clicked an item, it's not showing on that spinner. I hope someone canhelp me here. Thank you</p> </div>

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

Vue + Spring Boot 项目实战(十九):Web 项目优化解决方案

快来一起探索如何打脸我们的破项目,兄弟姐妹们把害怕打在公屏上!

你连存活到JDK8中著名的Bug都不知道,我怎么敢给你加薪

CopyOnWriteArrayList.java和ArrayList.java,这2个类的构造函数,注释中有一句话 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 public ArrayList(Collection&lt;? ...

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

CSDN:因博主近期注重写专栏文章(已超过150篇),订阅博主专栏人数在突增,近期很有可能提高专栏价格(已订阅的不受影响),提前声明,敬请理解!

CSDN:因博主近期注重写专栏文章(已超过150篇),订阅博主专栏人数在突增,近期很有可能提高专栏价格(已订阅的不受影响),提前声明,敬请理解! 目录 博客声明 大数据了解博主粉丝 博主的粉丝群体画像 粉丝群体性别比例、年龄分布 粉丝群体学历分布、职业分布、行业分布 国内、国外粉丝群体地域分布 博主的近期访问每日增量、粉丝每日增量 博客声明 因近期博主写专栏的文章越来越多,也越来越精细,逐步优化文章。因此,最近一段时间,订阅博主专栏的人数增长也非常快,并且专栏价

一个HashMap跟面试官扯了半个小时

一个HashMap能跟面试官扯上半个小时 关注 安琪拉的博客 1.回复面试领取面试资料 2.回复书籍领取技术电子书 3.回复交流领取技术电子书 前言 HashMap应该算是Java后端工程师面试的必问题,因为其中的知识点太多,很适合用来考察面试者的Java基础。 开场 面试官: 你先自我介绍一下吧! 安琪拉: 我是安琪拉,草丛三婊之一,最强中单(钟馗不服)!哦,不对,串场了,我是**,目...

我说我不会算法,阿里把我挂了。

不说了,字节跳动也反手把我挂了。

记录下入职中软一个月(外包华为)

我在年前从上一家公司离职,没想到过年期间疫情爆发,我也被困在家里,在家呆着的日子让人很焦躁,于是我疯狂的投简历,看面试题,希望可以进大公司去看看。 我也有幸面试了我觉得还挺大的公司的(虽然不是bat之类的大厂,但是作为一名二本计算机专业刚毕业的大学生bat那些大厂我连投简历的勇气都没有),最后选择了中软,我知道这是一家外包公司,待遇各方面甚至不如我的上一家公司,但是对我而言这可是外包华为,能...

面试:第十六章:Java中级开发

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

培训班出来的人后来都怎么样了?(二)

接着上回说,培训班学习生涯结束了。后面每天就是无休止的背面试题,不是没有头脑的背,培训公司还是有方法的,现在回想当时背的面试题好像都用上了,也被问到了。回头找找面试题,当时都是打印下来天天看,天天背。 不理解呢也要背,面试造飞机,上班拧螺丝。班里的同学开始四处投简历面试了,很快就有面试成功的,刚开始一个,然后越来越多。不知道是什么原因,尝到胜利果实的童鞋,不满足于自己通过的公司,嫌薪水要少了,选择...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

工作八年,月薪60K,裸辞两个月,投简历投到怀疑人生!

近日,有网友在某职场社交平台吐槽,自己裸辞两个月了,但是找工作却让自己的心态都要崩溃了,全部无果,不是已查看无回音,就是已查看不符合。 “工作八年,两年一跳,裸辞两个月了,之前月薪60K,最近找工作找的心态崩了!所有招聘工具都用了,全部无果,不是已查看无回音,就是已查看不符合。进头条,滴滴之类的大厂很难吗???!!!投简历投的开始怀疑人生了!希望 可以收到大厂offer” 先来看看网...

大牛都会用的IDEA调试技巧!!!

导读 前天面试了一个985高校的实习生,问了他平时用什么开发工具,他想也没想的说IDEA,于是我抛砖引玉的问了一下IDEA的调试用过吧,你说说怎么设置断点...

都前后端分离了,咱就别做页面跳转了!统统 JSON 交互

文章目录1. 无状态登录1.1 什么是有状态1.2 什么是无状态1.3 如何实现无状态1.4 各自优缺点2. 登录交互2.1 前后端分离的数据交互2.2 登录成功2.3 登录失败3. 未认证处理方案4. 注销登录 这是本系列的第四篇,有小伙伴找不到之前文章,松哥给大家列一个索引出来: 挖一个大坑,Spring Security 开搞! 松哥手把手带你入门 Spring Security,别再问密...

97年世界黑客编程大赛冠军作品(大小仅为16KB),惊艳世界的编程巨作

这是世界编程大赛第一名作品(97年Mekka ’97 4K Intro比赛)汇编语言所写。 整个文件只有4095个字节, 大小仅仅为16KB! 不仅实现了3D动画的效果!还有一段震撼人心的背景音乐!!! 内容无法以言语形容,实在太强大! 下面是代码,具体操作看最后! @echo off more +1 %~s0|debug e100 33 f6 bf 0 20 b5 10 f3 a5...

程序员是做全栈工程师好?还是专注一个领域好?

昨天,有位大一的同学私信我,说他要做全栈工程师。 我一听,这不害了孩子么,必须制止啊。 谁知,讲到最后,更确定了他做全栈程序员的梦想。 但凡做全栈工程师的,要么很惨,要么很牛! 但凡很牛的,绝不是一开始就是做全栈的! 全栈工程师听起来好听,但绝没有你想象的那么简单。 今天听我来给你唠,记得帮我点赞哦。 一、全栈工程师的职责 如果你学习编程的目的只是玩玩,那随意,想怎么学怎么学。...

不要再到处使用 === 了

我们知道现在的开发人员都使用 === 来代替 ==,为什么呢?我在网上看到的大多数教程都认为,要预测 JavaScript 强制转换是如何工作这太复杂了,因此建议总是使用===。这些都...

什么是a站、b站、c站、d站、e站、f站、g站、h站、i站、j站、k站、l站、m站、n站?00后的世界我不懂!

A站 AcFun弹幕视频网,简称“A站”,成立于2007年6月,取意于Anime Comic Fun,是中国大陆第一家弹幕视频网站。A站以视频为载体,逐步发展出基于原生内容二次创作的完整生态,拥有高质量互动弹幕,是中国弹幕文化的发源地;拥有大量超粘性的用户群体,产生输出了金坷垃、鬼畜全明星、我的滑板鞋、小苹果等大量网络流行文化,也是中国二次元文化的发源地。 B站 全称“哔哩哔哩(bilibili...

十个摸鱼,哦,不对,是炫酷(可以玩一整天)的网站!!!

文章目录前言正文**1、Kaspersky Cyberthreat real-time map****2、Finding Home****3、Silk – Interactive Generative Art****4、Liquid Particles 3D****5、WINDOWS93****6、Staggering Beauty****7、Ostagram图片生成器网址****8、全历史网址*...

终于,月薪过5万了!

来看几个问题想不想月薪超过5万?想不想进入公司架构组?想不想成为项目组的负责人?想不想成为spring的高手,超越99%的对手?那么本文内容是你必须要掌握的。本文主要详解bean的生命...

用了这个 IDE 插件,5分钟解决前后端联调!

点击上方蓝色“程序猿DD”,选择“设为星标”回复“资源”获取独家整理的学习资料!作者 |李海庆我是一个 Web 开发前端工程师,受到疫情影响,今天是我在家办公的第78天。开发了两周,...

大厂的 404 页面都长啥样?最后一个笑了...

每天浏览各大网站,难免会碰到404页面啊。你注意过404页面么?猿妹搜罗来了下面这些知名网站的404页面,以供大家欣赏,看看哪个网站更有创意: 正在上传…重新上传取消 腾讯 正在上传…重新上传取消 网易 淘宝 百度 新浪微博 正在上传…重新上传取消 新浪 京东 优酷 腾讯视频 搜...

自从喜欢上了B站这12个UP主,我越来越觉得自己是个废柴了!

不怕告诉你,我自从喜欢上了这12个UP主,哔哩哔哩成为了我手机上最耗电的软件,几乎每天都会看,可是吧,看的越多,我就越觉得自己是个废柴,唉,老天不公啊,不信你看看…… 间接性踌躇满志,持续性混吃等死,都是因为你们……但是,自己的学习力在慢慢变强,这是不容忽视的,推荐给你们! 都说B站是个宝,可是有人不会挖啊,没事,今天咱挖好的送你一箩筐,首先啊,我在B站上最喜欢看这个家伙的视频了,为啥 ,咱撇...

代码注释如此沙雕,会玩还是你们程序员!

某站后端代码被“开源”,同时刷遍全网的,还有代码里的那些神注释。 我们这才知道,原来程序员个个都是段子手;这么多年来,我们也走过了他们的无数套路… 首先,产品经理,是永远永远吐槽不完的!网友的评论也非常扎心,说看这些代码就像在阅读程序员的日记,每一页都写满了对产品经理的恨。 然后,也要发出直击灵魂的质问:你是尊贵的付费大会员吗? 这不禁让人想起之前某音乐app的穷逼Vip,果然,穷逼在哪里都是...

Java14 新特性解读

Java14 已于 2020 年 3 月 17 号发布,官方特性解读在这里:https://openjdk.java.net/projects/jdk/14/以下是个人对于特性的中文式...

前端还能这么玩?(女朋友生日,用前端写了一个好玩的送给了她,高兴坏了)

前端还能这么玩?(女朋友生日,用前端写了一个好玩的送给了她,高兴坏了)

爬虫(101)爬点重口味的

小弟最近在学校无聊的很哪,浏览网页突然看到一张图片,都快流鼻血。。。然后小弟冥思苦想,得干一点有趣的事情python 爬虫库安装https://s.taobao.com/api?_ks...

工作两年简历写成这样,谁要你呀!

作者:小傅哥 博客:https://bugstack.cn 沉淀、分享、成长,让自己和他人都能有所收获! 一、前言 最近有伙伴问小傅哥,我的简历怎么投递了都没有反应,心里慌的很呀。 工作两年了目前的公司没有什么大项目,整天的维护别人的代码,有坑也不让重构,都烦死了。荒废我一身技能无处施展,投递的简历也没人看。我是不动物园里的猩猩,狒狒了! 我要加班,我要996,我要疯狂编码,求给我个机会… ...

相关热词 c# 按行txt c#怎么扫条形码 c#打包html c# 实现刷新数据 c# 两个自定义控件重叠 c#浮点类型计算 c#.net 中文乱码 c# 时间排序 c# 必备书籍 c#异步网络通信
立即提问