好的我现在承认我是新手使用进度条我从不使用它但现在我需要使用它我有一个活动(主)和一个菜单,可以启动6个新的活动.从这些活动中有一个活动,它在ListView中加载数据需要3-4秒才能加载.这个活动解析json并将数据传递给另一个活动.如果用户单击此活动的菜单选项,我将如何显示进度条,并在加载列表时将其消失.
这是活动
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final Intent intent=new Intent(this ,GetLatAndLng.class);
setContentView(R.layout.listplaceholder);
//ProgressBar pb=(ProgressBar)findViewById(R.id.progressbar);
LocationManager locationManager;
String context=Context.LOCATION_SERVICE;
locationManager=(LocationManager)getSystemService(context);
Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_FINE);
criteria.setAltitudeRequired(false);
criteria.setBearingRequired(false);
criteria.setCostAllowed(true);
criteria.setPowerRequirement(Criteria.POWER_LOW);
String provider = locationManager.getBestProvider(criteria, true);
Location location = locationManager.getLastKnownLocation(provider);
final LocationListener locationListener = new LocationListener() {
public void onLocationChanged(Location location) {
updateWithNewLocation(location);
}
public void onProviderDisabled(String provider){
updateWithNewLocation(null);
}
public void onProviderEnabled(String provider){ }
public void onStatusChanged(String provider, int status,
Bundle extras){ }
};
updateWithNewLocation(location);
locationManager.requestLocationUpdates(provider, 2000, 10,
locationListener); …Run Code Online (Sandbox Code Playgroud) 嗨,我想知道什么是应用程序联系人资料图片.可能吗?他们在哪里存储用户的所有个人资料图片?谢谢!
我正在使用surfaceview播放本地mp4视频,这里是布局
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mainLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<SurfaceView
android:id="@+id/surface"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</SurfaceView>
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)
从代码我将全屏设置为surfaceview
int height = getWindowManager().getDefaultDisplay().getHeight(); //metrics.heightPixels;
int width = getWindowManager().getDefaultDisplay().getHeight(); //metrics.widthPixels;
mPreview = (SurfaceView) findViewById(R.id.surface);
LayoutParams lp = new FrameLayout.LayoutParams(width, height);
mPreview.setLayoutParams(lp);
holder = mPreview.getHolder();
holder.addCallback(this);
holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
//holder.setFixedSize(width, height);
holder.setSizeFromLayout();
Run Code Online (Sandbox Code Playgroud)
但是,现在问题是视频没有全屏播放,视频上方有黑屏.
截图http://i.imgur.com/WNFDM.png 如何播放全屏视频?
我有一个方法
String Address=search.getText().toString();
private String getAddressUrl() {
String mapUrl="http://maps.googleapis.com/maps/api/geocode/json?";
String add=Address; //Address is a String input by the user
String baseUrl1=mapUrl+"address="+add+"&sensor=true";
return baseUrl1;
}
Run Code Online (Sandbox Code Playgroud)
如果我输入像"170 william street New York,NY"这样的字符串,我在查询错误时会收到非法字符,因为它包含空格.
是否有任何方法可以在字符串中插入%20的空格Address
我将值传递给另一个活动,但始终为null值
public class SatelliteDirectActivity extends Activity {
private Intent intent;
private Bundle b;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
intent = new Intent(SatelliteDirectActivity.this,ClsMainActivitySatelliteDirect.class);
b = new Bundle();
setContentView(R.layout.initial_splash_screen);
boolean bCheckInternetConnectivity = checkInternetConnection();
if(!bCheckInternetConnectivity)
{
Toast.makeText(this, "Please ensure that you have a internet connectivity", Toast.LENGTH_SHORT);
finish();
}
else
{
new GetCountryInformation().execute();
}
startActivity(intent);
finish();
}
private boolean checkInternetConnection() {
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
// test for connection
if (cm.getActiveNetworkInfo() != …Run Code Online (Sandbox Code Playgroud) android ×5
bundle ×1
image ×1
java ×1
progress-bar ×1
string ×1
surfaceview ×1
url ×1
video ×1
whatsapp ×1