我正在尝试使用Android中的手机间隙运行Camera API,我正在运行所有类型的问题.
我刚刚复制了phonegap相机的例子.
我收到以下错误
07-12 18:18:00.706: E/Web Console(17837): Uncaught TypeError: Cannot read property 'SAVEDPHOTOALBUM' of undefined at file:///android_asset/www/index.html:98
07-12 18:17:59.456: E/Web Console(17837): Uncaught ReferenceError: Camera is not defined at file:///android_asset/www/index.html:67
Run Code Online (Sandbox Code Playgroud)
我尝试了所有其他目的地类型.它起作用了
destinationType: destinationType.FILE_URI
destinationType: Camera.DestinationType.FILE_URI
destinationType: destinationType.DATA_URL
Run Code Online (Sandbox Code Playgroud)
我还添加了相机和硬件相机权限的许可.但它仍然失败了
以下是以下内容
<!DOCTYPE html>
<html>
<head>
<title>Capture Photo</title>
<script type="text/javascript" charset="utf-8" src="phonegap-1.0.0.js"></script>
<script type="text/javascript" charset="utf-8">
var pictureSource; // picture source
var destinationType; // sets the format of returned value
// Wait for PhoneGap to connect with the device
//
document.addEventListener("deviceready",onDeviceReady,false);
// PhoneGap is …Run Code Online (Sandbox Code Playgroud) 我正在尝试在操作栏中创建一个像视图一样的徽章.(使用最新的支持库).
我正在尝试以下方式.但它说空指针异常.
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.activity_dashboard_menu, menu);
MenuItem textBadge = menu.findItem(R.id.badge);
RelativeLayout badgeLayout = (RelativeLayout) MenuItemCompat.getActionView(textBadge);
TextView tv = (TextView) badgeLayout.findViewById(R.id.actionbar_notifcation_textview);
tv.setText("12");
return super.onCreateOptionsMenu(menu);
}
Run Code Online (Sandbox Code Playgroud)
Menu.xml是
<item
android:id="@+id/badge"
android:actionLayout="@layout/actionbar_badge_layout"
android:icon="@drawable/btn_star_off_disabled_holo_light"
android:showAsAction="always|withText">
</item>
Run Code Online (Sandbox Code Playgroud)
而Layout.xml是
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="48dp"
android:layout_height="fill_parent"
android:layout_gravity="right" >
<!-- Menu Item Image -->
<ImageView
android:layout_width="48dp"
android:layout_height="fill_parent"
android:clickable="true"
android:src="@drawable/btn_star_off_disabled_holo_light" />
<!-- Badge Count -->
<TextView
android:id="@+id/actionbar_notifcation_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:padding="5dp"
android:text="99"
android:textColor="#ffffff" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
这是我的日志:
01-22 09:12:45.439: E/AndroidRuntime(4819): FATAL EXCEPTION: main
01-22 09:12:45.439: E/AndroidRuntime(4819): …Run Code Online (Sandbox Code Playgroud) android actionbarsherlock android-actionbar android-actionbar-compat
我正在使用view pager在页面之间导航.我正在使用FragmentStatePagerAdapter.我可以向一个方向滑动而没有任何问题.但是,如果我再刷回旧的那个.它崩溃了.我得到空指针异常.
03-12 10:20:34.273: E/AndroidRuntime(29035): Process: com.titlesource.notarymobile, PID: 29035
03-12 10:20:34.273: E/AndroidRuntime(29035): java.lang.NullPointerException
03-12 10:20:34.273: E/AndroidRuntime(29035): at android.support.v4.app.Fragment.instantiate(Fragment.java:399)
03-12 10:20:34.273: E/AndroidRuntime(29035): at android.support.v4.app.FragmentState.instantiate(Fragment.java:97)
03-12 10:20:34.273: E/AndroidRuntime(29035): at android.support.v4.app.FragmentManagerImpl.restoreAllState(FragmentManager.java:1790)
03-12 10:20:34.273: E/AndroidRuntime(29035): at android.support.v4.app.Fragment.performCreate(Fragment.java:1489)
03-12 10:20:34.273: E/AndroidRuntime(29035): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:893)
03-12 10:20:34.273: E/AndroidRuntime(29035): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
03-12 10:20:34.273: E/AndroidRuntime(29035): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
03-12 10:20:34.273: E/AndroidRuntime(29035): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1467)
03-12 10:20:34.273: E/AndroidRuntime(29035): at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:472)
03-12 10:20:34.273: E/AndroidRuntime(29035): at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:163)
03-12 10:20:34.273: E/AndroidRuntime(29035): at android.support.v4.view.ViewPager.populate(ViewPager.java:1068)
03-12 10:20:34.273: E/AndroidRuntime(29035): at android.support.v4.view.ViewPager.populate(ViewPager.java:914)
03-12 10:20:34.273: E/AndroidRuntime(29035): at android.support.v4.view.ViewPager$3.run(ViewPager.java:244)
03-12 10:20:34.273: …Run Code Online (Sandbox Code Playgroud) android android-fragments android-viewpager fragmentstatepageradapter
单击我的Tab活动后,我需要刷新我的Activity.目前它只显示以前的内容.我需要刷新我的活动,因此可以在后面加载新内容.这是我添加TabActivity的代码.请帮忙.感谢您的所有反馈.
private void setTabs()
{
addTab("Home", R.drawable.tab_home, OptionsActivity.class);
addTab("News", R.drawable.tab_search, JsonActivity.class);
addTab("Scores", R.drawable.tab_home, scores.class);
addTab("Video", R.drawable.tab_search, JsonActivity2.class);
addTab("Follow Us", R.drawable.tab_home, SAXParserActivity.class);
addTab("Socket", R.drawable.tab_search, socketAndroid.class);
}
private void addTab(String labelId, int drawableId, Class<?> c)
{
TabHost tabHost = getTabHost();
Intent intent = new Intent(this, c);
TabHost.TabSpec spec = tabHost.newTabSpec("tab" + labelId);
View tabIndicator = LayoutInflater.from(this).inflate(R.layout.tab_indicator, getTabWidget(), false);
TextView title = (TextView) tabIndicator.findViewById(R.id.title);
title.setText(labelId);
ImageView icon = (ImageView) tabIndicator.findViewById(R.id.icon);
icon.setImageResource(drawableId);
spec.setIndicator(tabIndicator);
spec.setContent(intent);
tabHost.addTab(spec);
}
Run Code Online (Sandbox Code Playgroud) android refresh android-intent tabactivity android-tabactivity
我有一个自定义列表。我试图仅水平滚动特定部分。例如,在下图中,我尝试仅水平滚动橙色框。

这是我的 XML 布局:在 XML 布局中,橙色框以“android:id="@+id/projected”开头
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="63dp"
android:layout_marginLeft="0dp"
android:background="@drawable/bkg_img_fullcell"
android:orientation="horizontal" >
<!-- Left Column -->
<LinearLayout
android:id="@+id/widget_lineupview_playerdata_container"
android:layout_width="wrap_content"
android:layout_height="@dimen/widget_lineup_table_row_height"
android:layout_toRightOf="@+id/sideView"
android:gravity="center_vertical"
android:layout_toLeftOf="@+id/projected"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="4" >
<!-- rel 1 -->
<LinearLayout
android:id="@+id/playername1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:layout_toRightOf="@+id/sideView">
<com.cbssports.nflapp.ffb.MyTextViewBold
android:id="@+id/widget_lineupview_playerdata_playername"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:inputType="text|textNoSuggestions"
android:layout_marginLeft="5dp"
android:maxLines="1"
android:text=""
android:textColor="#08233e"
android:textSize="15dp" />
</LinearLayout>
<!-- rel 2 -->
<LinearLayout
android:id="@+id/widget_lineupview_playerdata_playerStatsIconContainer"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_toRightOf="@+id/playername1"
android:orientation="horizontal" >
<ImageView
android:id="@+id/widget_lineupview_playerdata_statusIconSuspended"
android:layout_width="wrap_content"
android:layout_height="wrap_content" …Run Code Online (Sandbox Code Playgroud) android scrollview horizontal-scrolling horizontalscrollview android-layout