我有一个扩展View的类.我有另一个扩展活动的类,我想添加要在活动类中加载的第一个类.我尝试了以下代码
package Test2.pack;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
public class Test2 extends Activity {
/** Called when the activity is first created. */
static view v;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
try{
v = (view) View.inflate(Test2.this, R.layout.main2, null);
}catch(Exception e){
System.out.println(" ERR " + e.getMessage()+e.toString());
}
}
}
class view extends View{
public view(Context context) {
super(context);
}
}
Run Code Online (Sandbox Code Playgroud) 我有一个弹出对话框,我在其中加载webview.我想在webview加载到弹出窗口的顶部时显示progressBar.我已经找到了一种在网页加载时显示加载进度条的方法,但如果在弹出的对话框中加载了这个webview,则不会在其上显示progressBar.有人可以解释为什么会发生这种情况.
这是代码
[码]
@SuppressWarnings("static-access")
public void showPopUp(String url){
try{
Dialog dialog = new Dialog(Links.this);
LayoutInflater inflater = (LayoutInflater)getSystemService(Links.this.LAYOUT_INFLATER_SERVICE);
View vi = inflater.inflate(R.layout.link_popup, null);
dialog.setContentView(vi);
dialog.setTitle("Title here");
dialog.setCancelable(true);
WebView wb = (WebView) vi.findViewById(R.id.WebView01);
wb.setWebViewClient(new MyWebViewClient());
wb.getSettings().setJavaScriptEnabled(true);
wb.getSettings().setSupportZoom(true);
wb.loadUrl(url);
// final Activity MyActivity = this;
//
// progressDialog = ProgressDialog.show(dialog.getOwnerActivity(), "", "Loading....", true);
//
// wb.setWebChromeClient(new WebChromeClient() {
// public void onProgressChanged(WebView view, int progress)
// {
// MyActivity.setProgress(progress * 100); //Make the bar disappear after URL is loaded
// if(progress == …Run Code Online (Sandbox Code Playgroud) 任何人都可以为我提供解决方案.问题是我在一个带有jquery的html页面中动态生成thd id.我想找到最大的Id,如果id是例如:id0,id1,id2 ..........任何人都给我一个解决方案.谢谢你的阅读.
我在alertDialog中有一个4行文本,我想集中对齐它而不提供任何自定义布局.这是可能的.
我已经编写了一些代码来在设置中添加我的自定义帐户点击添加帐户后,我可以看到我的自定义帐户,点击时我会显示登录表单.在里面我打电话给下面的代码
if (mAccountManager.addAccountExplicitly(account, password, userData)) {
// worked
System.out.println("Account added");
} else {
// guess not
System.out.println("NOT DONE");
}
Run Code Online (Sandbox Code Playgroud)
第一次显示"添加帐户",但无法在"设置/帐户"中看到任何内容.任何人都可以帮助我.
这是完整的代码
Log.d("AuthenticatorActivity", "onCreate");
mAccountManager = AccountManager.get(getBaseContext());
String accountName = getIntent().getStringExtra(ARG_ACCOUNT_NAME);
mAuthTokenType = getIntent().getStringExtra(ARG_AUTH_TYPE);
if (mAuthTokenType == null)
mAuthTokenType = AccountGeneral.AUTHTOKEN_TYPE_FULL_ACCESS;
accountName= "test55";
findAccount(accountName);
System.out.println(mAuthTokenType + "accountName : " + accountName);
Bundle data = new Bundle();
data.putString(AccountManager.KEY_ACCOUNT_NAME, accountName);
data.putString(AccountManager.KEY_ACCOUNT_TYPE, mAuthTokenType);
data.putString(AccountManager.KEY_AUTHTOKEN, authtoken);
data.putString(PARAM_USER_PASS, password);
Bundle userData = new Bundle();
userData.putString("userObjectId", "2");
data.putBundle(AccountManager.KEY_USERDATA, userData);
final Intent res = new Intent();
res.putExtras(data);
final …Run Code Online (Sandbox Code Playgroud) 我正在开发一个ANDROID项目,我有很多图像,我想组织它.所以我需要在drawable文件夹中创建文件夹.但我不知道如何在我的程序中引用它.
例如:我有一个名为"image.png"的图像,我想将它放在drawable/myicons/image.png或res文件夹内的任何位置.